-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hang in AsyncQueue.join()
#715
Comments
Yes, recently during the code review I've been asking myself: "Why I'll do the change if a champion don't overtake me. |
|
Moreover, I will even say that it was added in 167cc80. And it looks like it first appeared in python-tulip as part of JoinableQueue. |
Due to the way
call_soon_threadsafe()
works, callingSyncQueue.task_done()
has one side effect: a race is possible betweenqueue._finished.set()
andqueue._finished.clear()
. As a result,queue._finished
(asyncio.Event
instance) can be set even when there were moreput()
calls thantask_done()
calls, causing an infinite loop with a complete blocking of the event loop and high CPU load:A possible solution would be to replace
asyncio.Event
withasyncio.Condition
.The text was updated successfully, but these errors were encountered: