Univention Bugzilla – Bug 45540
univention.admin.modules.update() is not thread safe
Last modified: 2017-11-01 13:49:25 CET
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().
Reproducer: import univention.admin.modules import threading import time def reload(): while True: time.sleep(0.5) univention.admin.modules.update() thread = threading.Thread(target=reload) thread.start() lo, po = univention.admin.uldap.getMachineConnection() while True: time.sleep(0.2) univention.admin.modules.init(lo, po, univention.admin.modules.get('users/user'))
Created attachment 9248 [details] udm_init_thread_save.py
Created attachment 9249 [details] patch
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() univention-directory-manager-modules.yaml 9ce6c33c4ed9 | Bug #45540: Merge branch 'fbest/45540-thread-safe-modules-update' into 4.2-2 227bca684ad1 | YAML Bug #45540
OK: errata-announce -V --only univention-directory-manager-modules.yaml FIXED: univention-directory-manager-modules.yaml → 602919ea99 OK: Jenkins OK: Code-Review OK: 436574accaa7
<http://errata.software-univention.de/ucs/4.2/206.html>