Bug 45540 - univention.admin.modules.update() is not thread safe
univention.admin.modules.update() is not thread safe
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 4.2
Other Linux
: P5 normal (vote)
: UCS 4.2-2-errata
Assigned To: Florian Best
Philipp Hahn
Depends on:
  Show dependency treegraph
Reported: 2017-10-13 16:39 CEST by Florian Best
Modified: 2017-11-01 13:49 CET (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:
Ticket number: 2017101021000294
Bug group (optional):
Max CVSS v3 score:

udm_init_thread_save.py (509 bytes, text/x-python)
2017-10-13 18:04 CEST, Florian Best
patch (1.50 KB, patch)
2017-10-13 18:07 CEST, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2017-10-13 16:39:10 CEST
During the years we had a lot (bug #35858 bug #26367 bug #27685 bug #36294 bug #5970 bug #6077 bug #28223 bug #29201 bug #29094 bug #28627 bug #45284 bug #27624) of tracebacks like this:

Traceback (most recent call last):
    univention.admin.modules.init(lo, pos, ext_attr_module)
  File "%PY2.7%/univention/admin/modules.py", line 120, in init
    univention.admin.ucr_overwrite_properties(module, lo)
  File "%PY2.7%/univention/admin/__init__.py", line 60, in ucr_overwrite_properties
    ucr_prefix = ucr_property_prefix % module.module
AttributeError: 'NoneType' object has no attribute 'module'

This may be a problem if a thread calls univention.admin.modules.update() (or others) during some other thread calls univention.admin.init().
Comment 1 Florian Best univentionstaff 2017-10-13 16:50:31 CEST

import univention.admin.modules
import threading
import time

def reload():
        while True:

thread = threading.Thread(target=reload)

lo, po = univention.admin.uldap.getMachineConnection()
while True:
        univention.admin.modules.init(lo, po, univention.admin.modules.get('users/user'))
Comment 2 Florian Best univentionstaff 2017-10-13 18:04:57 CEST
Created attachment 9248 [details]
Comment 3 Florian Best univentionstaff 2017-10-13 18:07:23 CEST
Created attachment 9249 [details]
Comment 4 Florian Best univentionstaff 2017-10-27 15:39:41 CEST
Patch slightly adapted and merged.

univention-directory-manager-modules (12.0.18-13)
9ce6c33c4ed9 | Bug #45540: Merge branch 'fbest/45540-thread-safe-modules-update' into 4.2-2
436574accaa7 | Bug #45540: fix thread safety of univention.admin.modules.update()

9ce6c33c4ed9 | Bug #45540: Merge branch 'fbest/45540-thread-safe-modules-update' into 4.2-2
227bca684ad1 | YAML Bug #45540
Comment 5 Philipp Hahn univentionstaff 2017-10-30 11:20:07 CET
OK: errata-announce -V --only univention-directory-manager-modules.yaml
FIXED: univention-directory-manager-modules.yaml → 602919ea99
OK: Jenkins
OK: Code-Review
OK: 436574accaa7
Comment 6 Arvid Requate univentionstaff 2017-11-01 13:49:25 CET