Bug 53817 - UMC: Traceback format logging is broken for threads
UMC: Traceback format logging is broken for threads
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-0-errata
Assigned To: Florian Best
Johannes Keiser
:
Depends on: 47114
Blocks:
  Show dependency treegraph
 
Reported: 2021-09-21 14:11 CEST by Florian Best
Modified: 2021-09-29 17:10 CEST (History)
0 users

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: 0.229
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:
best: Patch_Available+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2021-09-21 14:11:21 CEST
Bug #47114 changed the logging format of tracebacks e.g. to:

21.09.21 13:41:13.561  MAIN        ( ERROR   ) : Interner Server-Fehler in "udm/nav/object/query (navigation)".
Request: udm/nav/object/query (navigation)

  File "/usr/lib/python3/dist-packages/notifier/threads.py", line 80, in _run
    result = self._function()
  File "/usr/lib/python3/dist-packages/notifier/__init__.py", line 105, in __call__
    return self._function(*tmp, **self._kwargs)
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/udm/__init__.py", line 607, in _thread
    result = module.search(container, objectProperty, objectPropertyValue, superordinate, scope=scope, hidden=hidden)
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/udm/udm_ldap.py", line 685, in search
    result = self.module.lookup(None, ldap_connection, filter_s, base=container, superordinate=superordinate, scope=scope, sizelimit=sizelimit, **kwargs)
  File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 1773, in lookup
    filter_s = cls.lookup_filter(filter_s, lo)
  File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 1804, in lookup_filter
    filter_p.append_unmapped_filter_string(filter_s, cls.rewrite_filter, module.mapping)
  File "/usr/lib/python3/dist-packages/univention/admin/filter.py", line 124, in append_unmapped_filter_string
    walk(filter_p, rewrite_function, arg=mapping)
  File "/usr/lib/python3/dist-packages/univention/admin/filter.py", line 308, in walk
    walk(e, expression_walk_function, conjunction_walk_function, arg)
  File "/usr/lib/python3/dist-packages/univention/admin/filter.py", line 313, in walk
    expression_walk_function(filter_p, arg)
  File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 1867, in rewrite_filter
    filter.value = mapping.mapValueDecoded(key, filter.value)
  File "/usr/lib/python3/dist-packages/univention/admin/mapping.py", line 564, in mapValueDecoded
    value = value.decode(*self.getEncoding(map_name))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xad in position 11: invalid start byte

We should also log "Traceback (most recent call last)" - at least to easier search/grep for tracebacks:

diff --git management/univention-management-console/src/univention/management/console/base.py management/univention-management-console/src/univention/management/console/base.py
index ad90bf6754..80090d838f 100644
--- management/univention-management-console/src/univention/management/console/base.py
+++ management/univention-management-console/src/univention/management/console/base.py
@@ -360,7 +360,7 @@ class Base(signals.Provider, Translation):
                        status = MODULE_ERR_COMMAND_FAILED
                        reason = None
                        if etraceback is None:  # Bug #47114: thread.exc_info doesn't contain a traceback object anymore
-                               tb_str = ''.join(trace + traceback.format_exception_only(*sys.exc_info()[:2]))
+                               tb_str = ''.join(['Traceback (most recent call last):\n'] + trace + traceback.format_exception_only(*sys.exc_info()[:2]))
                        else:
                                tb_str = traceback.format_exc()
                        if isinstance(tb_str, bytes):  # Python 2


+++ This bug was initially created as a clone of Bug #47114 +++
Comment 1 Florian Best univentionstaff 2021-09-24 15:26:51 CEST
univention-management-console.yaml
c5686d402b66 | Bug #53817: fix traceback format of exception occuring in a thread

univention-management-console (12.0.12-15)
c5686d402b66 | Bug #53817: fix traceback format of exception occuring in a thread
Comment 2 Johannes Keiser univentionstaff 2021-09-29 09:33:13 CEST
OK: 'Traceback (most recent call last):\n' is added before traceback

yaml: 0c12c7b8d1 Bug #53817: yaml

-> verified