Bug 51166 - handle error during start of exam more safely
handle error during start of exam more safely
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: UMC - Exam mode
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v5-errata
Assigned To: Daniel Tröder
Ole Schwiegert
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-04-24 11:26 CEST by Ole Schwiegert
Modified: 2021-07-13 22:44 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 5: Blocking further progress on the daily work
User Pain: 0.229
Enterprise Customer affected?:
School Customer affected?: Yes
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 Ole Schwiegert univentionstaff 2020-04-24 11:26:17 CEST
A customer encountered the problem that during the start of an exam the project variable in the UMC process was None. This triggered the following traceback:

07.02.20 11:50:24.628  MODULE      ( PROCESS ) : Vorbereiten der Raumeinstellungen - beendet...
07.02.20 11:50:50.306  MODULE      ( PROCESS ) : Setting auth type to u'SAML'
07.02.20 11:51:00.770  MODULE      ( PROCESS ) : Diese Aktion erfordert die Eingabe Ihres Passwortes.
07.02.20 11:51:06.417  MODULE      ( PROCESS ) : Setting auth type to None
07.02.20 11:51:06.531  MODULE      ( ERROR   ) : Traceback (most recent call last):
  File "/usr/sbin/univention-management-console-module", line 121, in <module>
    notifier.loop()
  File "/usr/lib/python2.7/dist-packages/notifier/nf_generic.py", line 296, in loop
    step()
  File "/usr/lib/python2.7/dist-packages/notifier/nf_generic.py", line 287, in step
    __min_timer = dispatch.dispatcher_run()
  File "/usr/lib/python2.7/dist-packages/notifier/dispatch.py", line 75, in dispatcher_run
    if not disp():
  File "/usr/lib/python2.7/dist-packages/notifier/threads.py", line 161, in _simple_threads_dispatcher
    task.announce()
  File "/usr/lib/python2.7/dist-packages/notifier/threads.py", line 139, in announce
    self._callback(self, self._result)
  File "/usr/lib/python2.7/dist-packages/notifier/__init__.py", line 104, in __call__
    return self._function(*tmp, **self._kwargs)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/schoolexam/__init__.py", line 557, in _finished
    my.project.starttime = datetime.datetime.now()
AttributeError: 'NoneType' object has no attribute 'starttime'


To counteract this problem we want to harden the UMC modul and always check this property to exist. If it is None for some reason, the project shall be reloaded from the project file and if this also fails, we want to provide more meaningful feedback in the log and to the customer.
Comment 1 Daniel Tröder univentionstaff 2020-04-24 17:34:45 CEST
When an error occurred in schoolexam/__init__.py -> start_exam() -> _thread() it was not logged an the following _finished() function didn't check for an exception, so it failed with the above error.

The code has been changed to check the "result" condition and only continue if there was no exception in _thread().

[4.4] cc1a2118d Bug #51166: handle execption from _thread() in _finished()
[4.4] f751b0a15 Bug #51166: advisory update

ucs-school-umc-exam (9.0.1-37)
Comment 2 Ole Schwiegert univentionstaff 2020-04-27 07:43:04 CEST
Advisory&Changelog: OK
Tests: OK

An UMC error containing the exception is now thrown and is not obscured anymore by following errors after running the thread. That will give us the chance to better debug upcoming errors in the exam module.
Comment 3 Ole Schwiegert univentionstaff 2020-06-12 12:54:08 CEST
UCS@school 4.4 v5 has been released (errata update to the release).

https://docs.software-univention.de/changelog-ucsschool-4.4v5-de.html

If this error occurs again, please clone this bug.
Comment 4 Florian Best univentionstaff 2021-07-13 22:11:29 CEST
git:cc1a2118dd55e315489160b13d4db4983723be58 is wrong and causes the module process to crash. You cannot/must not raise an exception in the notifier thread finish callback.
I will revert and fix this correctly during the Python 3 migration.
Comment 5 Florian Best univentionstaff 2021-07-13 22:40:12 CEST
see temporarily commit git:56b3e30def96d4b9327bf59fe78cfed0e1fbe5b2 for a fix.