-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Protect tasks weak set manipulation in asyncio.all_tasks() #79151
Comments
Traceback (most recent call last):
File "C:\Users\max\AppData\Local\Programs\Python\Python37\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "D:\Proj\antwork\code\antwork_backend\server\data_handlers\order\playback_hd.py", line 147, in run
send_to_ws(channel=self.room_name, data=json.loads(msg))
File "D:\Proj\antwork\code\antwork_backend\server\data_exchange.py", line 26, in send_to_ws
asyncio.run(channel_layer.group_send(channel, send_data))
File "C:\Users\max\AppData\Local\Programs\Python\Python37\lib\asyncio\runners.py", line 46, in run
_cancel_all_tasks(loop)
File "C:\Users\max\AppData\Local\Programs\Python\Python37\lib\asyncio\runners.py", line 54, in _cancel_all_tasks
to_cancel = tasks.all_tasks(loop)
File "C:\Users\max\AppData\Local\Programs\Python\Python37\lib\asyncio\tasks.py", line 38, in all_tasks
return {t for t in _all_tasks
File "C:\Users\max\AppData\Local\Programs\Python\Python37\lib\asyncio\tasks.py", line 38, in <setcomp>
return {t for t in _all_tasks
File "C:\Users\max\AppData\Local\Programs\Python\Python37\lib\_weakrefset.py", line 61, in __iter__
for itemref in self.data:
RuntimeError: Set changed size during iteration |
The issue is hard to reproduce, the problem happens on an implicit garbage collector run during iteration over |
Ned, would be nice to have this trivial bugfix in 3.7.1. The problem happens if wakes up on weakset iteration. |
3.7.1rc2 is about to be released so to add this would require retagging and remanufacturing release bits. If the chances of it happening are "very low", I would prefer to not further delay rc2. If you and Yury agree that the risk is low and the benefit is high, we could consider risking cherry-picking it to 3.7.1 final. Sound OK? |
Let's wait for Yuri opinion. |
I agree it's a pretty serious bug; basically a time bomb that can crash a perfectly fine asyncio application. The PR itself seems to be safe to cherry-pick to 3.7.1 even after rc2. I suggest to merge it asap though to have some time for buildbots to test it. |
Ned, the fix has landed on both master and 3.7 Your turn, please. |
Thanks, Andrew and Yury! Just leave the issue open as a "release blocker" for now and I will take care of it for 3.7.1 final. |
Cool! |
Released in 3.7.1 |
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: