Module: check_mk
Branch: master
Commit: 4112ae3601e1fd21c89deebd0619b280cb14229c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4112ae3601e1fd…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Feb 20 14:46:40 2019 +0100
7177 FIX Fix background job warning "IOError: [Errno 9] Bad file descriptor"
When starting a background job an unproblematic error message like this could
occur in the output of the background job log:
<code>
sys.stdin.close()
IOError: [Errno 9] Bad file descriptor
</code>
This was caused by an unclean stdin/stdout/stderr handling during job startup
since commit cd6563801d1de1bdb89edc23788c17904f296aa1.
Change-Id: I09a652b2f2373cf332aa37b8b4a0b23a493e189b
---
.werks/7177 | 20 ++++++++++++++++++++
cmk/gui/background_job.py | 3 +++
2 files changed, 23 insertions(+)
diff --git a/.werks/7177 b/.werks/7177
new file mode 100644
index 0000000..5786327
--- /dev/null
+++ b/.werks/7177
@@ -0,0 +1,20 @@
+Title: Fix background job warning "IOError: [Errno 9] Bad file descriptor"
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1550667579
+
+When starting a background job an unproblematic error message like this could
+occur in the output of the background job log:
+
+<code>
+sys.stdin.close()
+IOError: [Errno 9] Bad file descriptor
+</code>
+
+This was caused by an unclean stdin/stdout/stderr handling during job startup
+since commit b15dfeb619c14c925b66f2a3437d213852204975.
diff --git a/cmk/gui/background_job.py b/cmk/gui/background_job.py
index dbeefa7..b493c57 100644
--- a/cmk/gui/background_job.py
+++ b/cmk/gui/background_job.py
@@ -152,6 +152,9 @@ class BackgroundProcess(BackgroundProcessInterface,
multiprocessing.Process):
# Detach from parent and cleanup inherited file descriptors
os.setsid()
daemon.set_procname(BackgroundJobDefines.process_name)
+ sys.stdin.close()
+ sys.stdout.close()
+ sys.stderr.close()
daemon.closefrom(0)
try: