Bug 40166 - The output of import hooks is not flushed promptly
The output of import hooks is not flushed promptly
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.1
Other Linux
: P5 normal (vote)
: UCS@school 4.1 Errata
Assigned To: Sönke Schwardt-Krummrich
Florian Best
:
Depends on:
Blocks: 40788
  Show dependency treegraph
 
Reported: 2015-12-03 14:36 CET by Sönke Schwardt-Krummrich
Modified: 2016-03-16 15:01 CET (History)
1 user (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): External feedback
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2015-12-03 14:36:03 CET
During import via CLI tools the output of input hook scripts is not flushed promptly/in time. So the output of 10 import hook instances is written as coherent region to the logfile. This makes debugging faily time consuming if not impossible.
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2016-02-28 16:04:24 CET
Analysing the customer output revealed that the output of the python process is buffered and only partially written to stdout/stderr. Then the hook scripts are called that print their output to stdout/stderr and flush stdout/stderr upon exit.

In the end the output looks like this:
(A=Output of the python process before calling the hook,
 B=Output of the python process after calling the hook,
 H=Output of the hook script)

AAAAAAAA
AAAAAAAA
AAAHHHHHHHH
HHHHHHHH
HHHHHHHH
HHHHHHHH
HHHHHHHH
AAAAA
AAAAAAAA
BBBBBBBB
BBBBBBBB

To prevent this, a sys.stdout.flush(), sys.stderr.flush() has been inserted right before calling the hook script.

ucs-school-import (12.0.4-1):
r67763 | Bug #40166: flush stdout and stderr before calling hook scripts
Comment 2 Florian Best univentionstaff 2016-02-29 15:50:36 CET
I could not reproduce this on CLI with create_ou but the code looks reasonable and doesn't break anything.
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2016-03-16 15:01:08 CET
UCS@school 4.1 v5 has been released.

If this error occurs again, please clone this bug.