We've hit this few more times in last months. When hub is being restarted in same time as kojid we can end in situation, when task is cancelled properly, but build hangs in BUILDING state. I'm not sure how to approach this.
BUILDING
Simple helper: https://pagure.io/koji-tools/pull-request/13
While it would probably be good to have some sort of process to clean these up after the fact. Perhaps either gc or kojira could eventually grow in scope to do other sorts of maintenance work like thjis, I wonder if we could simply prevent this situation from happening in the first place.
Do we have an understanding of the sorts of chain of events that leads to this situation? There aren't really that many places where we cancel tasks in the code:
wait()
cancelTaskChildren
It is really only the last one I can see being the issue here. Perhaps task cancellation should also cancel a linked build?
I suspect the failBuild method. For cases I've found possible scenario is this:
failBuild
completeBuild
ServerExit
It is rare race condition, but with amount of builds we've now it is not as rare (about 7 cases last restart time).
Commit a8b57118 relates to this ticket
This issue has been migrated to Fedora Forge: https://forge.fedoraproject.org/koji/koji/issues/972
Please continue any further discussion there.