Skip to content

Commit 50dd569

Browse files
fix(processor): race condition that could result in node errors not getting reported
I had set the cancel event at some point during troubleshooting an unrelated issue. It seemed logical that it should be set there, and didn't seem to break anything. However, this is not correct. The cancel event should not be set in response to a queue status change event. Doing so can cause a race condition when nodes are executed very quickly. It's possible that a previously-executed session's queue item status change event is handled after the next session starts executing. The cancel event is set and the session runner sees it aborting the session run early. In hindsight, it doesn't make sense to set the cancel event here either. It should be set in response to user action, e.g. the user cancelled the session or cleared the queue (which implicitly cancels the current session). These events actually trigger the queue item status changed event, so if we set the cancel event here, we'd be setting it twice per cancellation.
1 parent 125e1d7 commit 50dd569

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

invokeai/app/services/session_processor/session_processor_default.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ async def _on_queue_event(self, event: FastAPIEvent) -> None:
374374
"failed",
375375
"canceled",
376376
]:
377-
self._cancel_event.set()
378377
self._poll_now()
379378

380379
def resume(self) -> SessionProcessorStatus:

0 commit comments

Comments
 (0)