Call task_done() for stop sentinel in dispatch_events#1159
Merged
BoboTiG merged 2 commits intogorakhargosh:masterfrom Feb 20, 2026
Merged
Call task_done() for stop sentinel in dispatch_events#1159BoboTiG merged 2 commits intogorakhargosh:masterfrom
BoboTiG merged 2 commits intogorakhargosh:masterfrom
Conversation
When dispatch_events receives the stop sentinel from the event queue, it returns immediately without calling event_queue.task_done(). This leaves the queue's internal unfinished-task counter permanently off by one, so any subsequent event_queue.join() will block forever. Add the missing task_done() call before returning on the stop path.
Collaborator
|
A line in the changelog and I'll merge, thanks for spotting this one! |
Contributor
Author
|
Added a changelog entry. Thanks for the review! |
1 similar comment
Contributor
Author
|
Added a changelog entry. Thanks for the review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BaseObserver.dispatch_eventscallsevent_queue.get()to pull items off the queue. For normal events, it dispatches them to handlers and then callsevent_queue.task_done(). However, when it receives the stop sentinel, it returns immediately without callingtask_done().Queue.task_done()must be called once for everyget()to keep the queue's internal unfinished-task counter accurate. Skipping it means the counter is permanently off by one, causing any subsequentevent_queue.join()to block indefinitely.The fix adds the missing
task_done()call on the stop-event path, beforereturn.