Bug 37366 - unify UMC server/module error handling
unify UMC server/module error handling
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 4.0
Other Linux
: P5 normal (vote)
: UCS 4.0-2-errata
Assigned To: Florian Best
Dirk Wiesenthal
:
: 25987 34047 35972 37458 38018 (view as bug list)
Depends on: 37169
Blocks:
  Show dependency treegraph
 
Reported: 2014-12-16 16:50 CET by Florian Best
Modified: 2015-05-28 16:48 CEST (History)
4 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): Cleanup, Error handling, Troubleshooting
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 2014-12-16 16:50:13 CET
The internal error handling should be unified so that UMC-Server + UMC-Modules + Threaded-Methods all use the same error handling function.

This has the advantage that the server will be more robust. Currently it crashes at every exception in the internal server commands. This can be prevented if we use the generic error handling which is already outsourced into a single function/decorator.

The status codes which differentiate a UMC-Module error and a UMC-Server error are not necessary. The real HTTP status code 500 should be used.

A unified format of the JSON error response could be implemented for errors. Currently everything is a string using the "message" attribute of the UMCP response. Status titles are generated by the frontend, this is the job of the backend (errors should be viewable independent of the user agent software).

+++ This bug was initially created as a clone of Bug #37169 +++
Comment 1 Florian Best univentionstaff 2014-12-18 14:09:38 CET
*** Bug 25987 has been marked as a duplicate of this bug. ***
Comment 2 Florian Best univentionstaff 2015-05-12 16:56:06 CEST
Using this bug to make the UMC server robust against crashing during request processing.
Comment 3 Florian Best univentionstaff 2015-05-12 16:57:34 CEST
*** Bug 34047 has been marked as a duplicate of this bug. ***
Comment 4 Florian Best univentionstaff 2015-05-12 17:00:49 CEST
*** Bug 35972 has been marked as a duplicate of this bug. ***
Comment 5 Florian Best univentionstaff 2015-05-12 17:02:26 CEST
*** Bug 38018 has been marked as a duplicate of this bug. ***
Comment 6 Florian Best univentionstaff 2015-05-12 17:31:32 CEST
*** Bug 37458 has been marked as a duplicate of this bug. ***
Comment 7 Florian Best univentionstaff 2015-05-13 17:08:06 CEST
The UMC can't crash anymore when handling requests. It is still possible that it crashes on startup. This could be fixed via Bug #33427 or more explicit in another bug.

The internal UMC commands now have the same error handling as the modules.
Nothing changed in the traceback format (I will do this in Bug #38204).

Nice side effects:
Modules are now also able to call self.get_user_ldap_connection().
Internal server functions may now use our decorators/sanitizers.

YAML: 2015-05-12-univention-management-console.yaml
Package: univention-management-console
Version: 7.1.63-17.859.201505131137
Comment 8 Florian Best univentionstaff 2015-05-18 10:02:50 CEST
Currently a import error when protocol is not imported first. E.g. on python-cli:
"import univention.management.console.modules"
Comment 9 Florian Best univentionstaff 2015-05-18 10:14:24 CEST
univention-management-console (7.1.63-18):
r60749 | Bug #37366: fix import order
Comment 10 Tim Petersen univentionstaff 2015-05-19 11:24:40 CEST
Thx for fixing - this currently prevents useful debugging on 3.2 customer environments with computerroom issues. I see "Attribute status just available for MIME type application/json" like 10 times a seconds in ...server.log and ...web-server.log.

Backport would be highly appreciated
Comment 11 Florian Best univentionstaff 2015-05-26 17:19:07 CEST
The translation is broken due to r60749.
Comment 12 Florian Best univentionstaff 2015-05-26 18:24:29 CEST
(In reply to Florian Best from comment #11)
> The translation is broken due to r60749.
The order of setting the locale and importing the module did matter because the univention.lib.Translation() instances were bound to the set locale on import time.

Example (was broken, is fixed again):
>>> from univention.management.console import Translation
>>> from locale import *
>>> setlocale(LC_ALL, 'de_DE.UTF-8')
'de_DE.UTF-8'
>>> _ = Translation('univention-management-console').translate
>>> _('The account is expired and can not be used anymore')
'The account is expired and can not be used anymore'
→ is german again.

Well, this is a general problem we ever had and also have in udm. I added some comments to the code so that this will not occur again.
Comment 13 Florian Best univentionstaff 2015-05-27 10:57:19 CEST
All YAML descriptions have been adapted. The order of bug numbers fit to the descriptions. Every bug has it's own description. Please recheck *appcenter.yaml, *lib.yaml, *console.yaml.
Comment 14 Dirk Wiesenthal univentionstaff 2015-05-27 11:04:25 CEST
OK, works. YAML OK
Comment 15 Janek Walkenhorst univentionstaff 2015-05-28 16:48:28 CEST
<http://errata.univention.de/ucs/4.0/199.html>