-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
asyncio.create_task weakrefset race condition #89125
Comments
with the following demo script I can get a IndexError: pop from empty list
here's a live demo on github actions: https://github.com/graingert/asyncio-backport/runs/3380502247#step:5:90 |
still happens on 3.10 even though there's an
|
interestingly 3.10 didn't show: sys:1: RuntimeWarning: coroutine 'BaseEventLoop.shutdown_asyncgens' was never awaited |
I can reproduce on 3.9.6 A little digging and it seems asyncio imports Task from _asyncio weakref.WeakSet is not thread-safe, which means concurrent create_task's in different threads (even on separate event loops) is not safe. |
actually it looks like WeakSet is *supposed* to be thread-safe
|
Thanks, Thomas! ✨ 🍰 ✨ |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: