Bug 53249 - python-notifier: RuntimeError: dictionary changed size during iteration
python-notifier: RuntimeError: dictionary changed size during iteration
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0
Assigned To: Florian Best
Arvid Requate
: interim-5
Depends on: 51282
Blocks:
  Show dependency treegraph
 
Reported: 2021-05-12 09:06 CEST by Florian Best
Modified: 2023-05-23 11:58 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2021-05-12 09:06:55 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.
Comment 1 Florian Best univentionstaff 2021-05-12 12:37:33 CEST
Fixed in:

python-notifier (0.9.8-6)
4eefae1aad99 | Bug #53249: fix "RuntimeError: dictionary changed size during iteration" in timeout selection
Comment 2 Arvid Requate univentionstaff 2021-05-12 20:10:11 CEST
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.
Comment 3 Arvid Requate univentionstaff 2021-05-14 14:35:23 CEST
Anyway, this bug is fixed, lets discuss the other issue later.
Comment 4 Philipp Hahn univentionstaff 2021-05-20 11:01:39 CEST
(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
Comment 5 Florian Best univentionstaff 2021-05-25 15:58:18 CEST
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".