Page MenuHomePhabricator

Welcome I/O and dict-in-memory management is extremely racey
Open, NormalPublic

Description

Needs full stack trace, but this type of issue is typically caused by multiple threads manipulating the same iterable at the same time.

[2021-01-23 19:03:45,694] sopel.bot            ERROR    - Unexpected error (dictionary changed size during iteration) from Voidwalker at 2021-01-23 19:03:45.694143. Message was: VoidTraceback (most recent call last):  File "/srv/sopelbots/devvenv/lib/python3.7/site-packages/sopel/bot.py", line 606, in call    exit_code = func(sopel, trigger)  File "/srv/sopelbots/devvenv/lib/python3.7/site-packages/MirahezeBots/plugins/welcome.py",

Jan 23 19:03:45 100 sopel[24937]: [2021-01-23 19:03:45,694] sopel.bot            ERROR    - Unexpected error (dictionary changed size during iteration) from Voidwalker at 2021-01-23 19:03:45.694143. Message was: Void
Jan 23 19:03:45 100 sopel[24937]: Traceback (most recent call last):
Jan 23 19:03:45 100 sopel[24937]:   File "/srv/sopelbots/devvenv/lib/python3.7/site-packages/sopel/bot.py", line 606, in call
Jan 23 19:03:45 100 sopel[24937]:     exit_code = func(sopel, trigger)
Jan 23 19:03:45 100 sopel[24937]:   File "/srv/sopelbots/devvenv/lib/python3.7/site-packages/MirahezeBots/plugins/welcome.py", line 80, in welcome_user
Jan 23 19:03:45 100 sopel[24937]:     save_known_users_list(bot.known_users_filename, bot.known_users_list)
Jan 23 19:03:45 100 sopel[24937]:   File "/srv/sopelbots/devvenv/lib/python3.7/site-packages/MirahezeBots/plugins/welcome.py", line 52, in save_known_users_list
Jan 23 19:03:45 100 sopel[24937]:     for channel in known_users_list:
Jan 23 19:03:45 100 sopel[24937]: RuntimeError: dictionary changed size during iteration

Details

Security
None

Event Timeline

RhinosF1 renamed this task from Possible threading issue in welcome.py to Welcome I/O and dict-in-memory management is extremely racey.Jan 23 2021, 8:29 PM

We've got a schema so probably best to just switch this to bot.db

RhinosF1 triaged this task as Normal priority.Jan 23 2021, 8:35 PM
MacFan4000 added a subscriber: MacFan4000.

Not sure why this has anything to do with a closed task.

Because my plan to handle it requires that schema in place