Module: check_mk
Branch: master
Commit: 87e8ede5e797ee1d85cd78e61292dc27a06f90ac
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=87e8ede5e797ee…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Sep 14 11:53:56 2016 +0200
3802 FIX Fixed excess Check Helper PIPEs when a datasource program runs into a timeout
A timeout during the execution of a datasource program could cause
leftover stderr/stderr pipes for the Check_MK Helper process.
---
.werks/3802 | 11 +++++++++++
ChangeLog | 1 +
modules/check_mk_base.py | 8 +++++++-
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/.werks/3802 b/.werks/3802
new file mode 100644
index 0000000..a7bae20
--- /dev/null
+++ b/.werks/3802
@@ -0,0 +1,11 @@
+Title: Fixed excess Check Helper PIPEs when a datasource program runs into a timeout
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i1
+Date: 1473846635
+Class: fix
+
+A timeout during the execution of a datasource program could cause
+leftover stderr/stderr pipes for the Check_MK Helper process.
+
diff --git a/ChangeLog b/ChangeLog
index ef36208..5210c40 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -387,6 +387,7 @@
* 3801 FIX: Fixed race condition with persisted data...
* 3854 FIX: juniper_bgp_state: Fixed service descriptions in some cases...
* 3837 FIX: Fixed empty check if lnx_if info contains additional line...
+ * 3802 FIX: Fixed excess Check Helper PIPEs when a datasource program runs into a
timeout...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 48b385a..ea690fb 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -775,9 +775,15 @@ def get_agent_info_program(commandline):
if p:
os.killpg(os.getpgid(p.pid), signal.SIGTERM)
raise
-
except Exception, e:
raise MKAgentError("Could not execute '%s': %s" % (exepath,
e))
+ finally:
+ # The stdout and stderr pipe are not closed correctly on a MKTimeout
+ # Normally these pipes getting closed after p.communicate finishes
+ # Closing them a second time in a OK scenario won't hurt neither..
+ if p:
+ p.stdout.close()
+ p.stderr.close()
if exitstatus:
if exitstatus == 127: