Bug 33673 - Tracebacks in UMC module init() function are not logged
Tracebacks in UMC module init() function are not logged
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 3.0
Other Linux
: P5 normal (vote)
: UCS 3.2-0-errata
Assigned To: Florian Best
Dirk Wiesenthal
:
: 28746 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-05 22:42 CET by Alexander Kläser
Modified: 2015-03-18 12:40 CET (History)
3 users (show)

See Also:
What kind of report is it?: ---
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 Alexander Kläser univentionstaff 2013-12-05 22:42:57 CET
I forced a traceback in the init method if the UCR module and could observe the following:

> ==> /var/log/univention/management-console-server.log <==
> 05.12.13 22:31:42.146  MAIN        ( INFO    ) : Connected to new module process
> 05.12.13 22:31:42.146  PROTOCOL    ( INFO    ) : Sending UMCP SET REQUEST 138627910214672-5

→ this is actually the request during which the init method is invoked

> 05.12.13 22:31:42.147  PROTOCOL    ( INFO    ) : Sending UMCP COMMAND REQUEST 138627910173450-1941
> 05.12.13 22:31:42.147  PROTOCOL    ( INFO    ) : Sending UMCP COMMAND REQUEST 138627910181606-1942
> 
> ==> /var/log/univention/management-console-module-ucr.log <==
> 05.12.13 22:31:42.147  MAIN        ( INFO    ) : Incoming connection from 
> 05.12.13 22:31:42.147  PARSER      ( INFO    ) : UMCP REQUEST 138627910214672-5 parsed successfully
> 05.12.13 22:31:42.148  MODULE      ( INFO    ) : Received request 138627910214672-5
> 05.12.13 22:31:42.148  PROTOCOL    ( INFO    ) : Received UMCP SET REQUEST 138627910214672-5
> 05.12.13 22:31:42.148  MODULE      ( INFO    ) : Setting specified locale (en_US.UTF-8)
> 05.12.13 22:31:42.148  MODULE      ( INFO    ) : Setting user LDAP DN uid=Administrator,cn=users,dc=ucs32,dc=qa
> 05.12.13 22:31:42.148  MODULE      ( ERROR   ) : ### provoking traceback

→ at this point the error is raised

> 05.12.13 22:31:42.149  PROTOCOL    ( INFO    ) : Sending UMCP RESPONSE 138627910214672-5

→ the response contains the traceback

> ==> /var/log/univention/management-console-server.log <==
> 05.12.13 22:31:42.149  PARSER      ( INFO    ) : UMCP RESPONSE 138627910214672-5 parsed successfully
> 05.12.13 22:31:42.149  PROTOCOL    ( INFO    ) : Received UMCP RESPONSE 138627910214672-5
> 05.12.13 22:31:42.149  MAIN        ( INFO    ) : The given response is invalid or not known (138627910214672-5)

→ usually this entry can be observed in the UMC server log file. The response containing the traceback is ignored as invalid as its ID is not in the list of known requests. Forcing the server to dump the message, we see the traceback:

> RESPONSE/138627910214672-5/384/application/json: SET 
> {"status": 590, "message": "The init function of the module has failed: RuntimeError: ERROR
>   File \"/usr/lib/pymodules/python2.6/univention/management/console/protocol/modserver.py\", line 222, in handle
>     self.__handler.init()
>   File \"/usr/lib/pymodules/python2.6/univention/management/console/modules/ucr/__init__.py\", line 54, in init
>     raise RuntimeError('ERROR')
> "}

It would be helpful to see this error message in order to identify problems as in Bug 33627.
Comment 1 Florian Best univentionstaff 2013-12-06 08:39:28 CET
> → usually this entry can be observed in the UMC server log file. The response 
> containing the traceback is ignored as invalid as its ID is not in the list of 
> known requests. Forcing the server to dump the message, we see the traceback:
Yes, internally there is a SET request send to the Moduleprocess (which is no request from the frontend).

Shouldn't the moduleprocess exit when init() fails?
Comment 2 Alexander Kläser univentionstaff 2013-12-12 14:38:17 CET
(In reply to Florian Best from comment #1)
> ...
> Shouldn't the moduleprocess exit when init() fails?

Well, it would be consistent, otherwise side effects may happen unnoticed or they may happen at a later state which will be difficult to recognize.
Comment 3 Florian Best univentionstaff 2013-12-13 16:52:58 CET
A feedback in form of a traceback is now sent to the client if the initialization of a module fails.

YAML: 2013-12-13-univention-management-console.yaml
Comment 4 Dirk Wiesenthal univentionstaff 2014-01-09 15:41:18 CET
If something went wrong during module initialization (i.e. during "import time"), I get a traceback "ImportError: wizard does not exist" (or something like that). Shortly after that I get a dialogue that the connection is lost and the client is trying to reconnect.

Before this change we got "Connection to module process failed". While I like the fact that now a traceback is shown, it is useless in the current form. Please show the correct traceback. Is this "import wizard" really used anywhere or does it only exist to hide the real error?

Please also have a look at the dialogue popping up (it better does not!). Maybe it was because I used "?username=Administrator&password=secret"?
Comment 5 Florian Best univentionstaff 2014-01-14 08:39:40 CET
*** Bug 28746 has been marked as a duplicate of this bug. ***
Comment 6 Florian Best univentionstaff 2014-01-14 10:23:05 CET
(In reply to Dirk Wiesenthal from comment #4)
> If something went wrong during module initialization (i.e. during "import
> time"), I get a traceback "ImportError: wizard does not exist" (or something
> like that). Shortly after that I get a dialogue that the connection is lost
> and the client is trying to reconnect.
The import of univention.management.console.wizards.$modulename is not used and has been removed.

> Before this change we got "Connection to module process failed". While I
> like the fact that now a traceback is shown, it is useless in the current
> form. Please show the correct traceback. Is this "import wizard" really used
> anywhere or does it only exist to hide the real error?
This was a typo, the correct traceback is no shown.

> Please also have a look at the dialogue popping up (it better does not!).
> Maybe it was because I used "?username=Administrator&password=secret"?
This is related to the updater module and would have to be fixed there.

univention-management-console 6.0.23-1.773.201312131648
univention-management-console-frontend 3.0.152-8.805.201401141007
Comment 7 Dirk Wiesenthal univentionstaff 2014-01-23 11:28:43 CET
OK:
 * Shows up in logs
 * Is sent to the frontend
 * Works for ImportError and __init__() and init()
 * Module dies reasonably fast so that a new one is usable after a temporary (network) error

YAML OK
Comment 8 Moritz Muehlenhoff univentionstaff 2014-01-29 11:20:50 CET
http://errata.univention.de/ucs/3.2/40.html
Comment 9 Florian Best univentionstaff 2015-03-18 12:40:05 CET
Fix was in svn r46753 and r47061