Univention Bugzilla – Bug 53249
python-notifier: RuntimeError: dictionary changed size during iteration
Last modified: 2023-05-23 11:58:39 CEST
A traceback occurred in /var/log/univention/management-console-web-server.log: https://jenkins.knut.univention.de:8181/job/UCS-5.0/job/UCS-5.0-0/job/AutotestJoin/SambaVersion=s4,Systemrolle=master-part-II/ws/test/management-console-web-server.log Traceback (most recent call last): File "/usr/sbin/univention-management-console-web-server", line 1652, in run notifier.loop() File "/usr/lib/python3/dist-packages/notifier/nf_generic.py", line 306, in loop step() File "/usr/lib/python3/dist-packages/notifier/nf_generic.py", line 220, in step for interval, timestamp, callback in __timers.values(): RuntimeError: dictionary changed size during iteration The UMC-Webserver crashed.
Fixed in: python-notifier (0.9.8-6) 4eefae1aad99 | Bug #53249: fix "RuntimeError: dictionary changed size during iteration" in timeout selection
The patch looks good as __timers may be changed via parallel calls to either timer_add or timer_remove. Commit be111672 already fixed a similar loop over __timers a couple of lines later. Maybe we should also adjust this loop in socket_remove ? for descriptor, item in __sock_objects.items(): There's a socket_add function which may run in parallel.
Anyway, this bug is fixed, lets discuss the other issue later.
(In reply to Arvid Requate from comment #3) > Anyway, this bug is fixed, lets discuss the other issue later. FYI for documentation purpose only: Q: What guarantees that `list(some_dict)` is atomic? A: python3 -c '__import__("dis").dis("list({})")' 1 0 LOAD_NAME 0 (list) 2 BUILD_MAP 0 4 CALL_FUNCTION 1 6 RETURN_VALUE I: CPython does Thread-switching at Python byte-code boundaries only
UCS 5.0 has been released: https://docs.software-univention.de/release-notes-5.0-0-en.html https://docs.software-univention.de/release-notes-5.0-0-de.html If this error occurs again, please use "Clone This Bug".