Module: check_mk
Branch: master
Commit: 5195ae65da3d67f365443408ff7204a74a22c05f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5195ae65da3d67…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 27 09:01:36 2017 +0100
4400 FIX Fixed possible random "OSError: [Errno 9] Bad file descriptor" in GUI
During rendering of any page in the GUI this error could occur. Restarting the
apache of the site should fix the issue for some time.
Change-Id: I122a427e6f9ef49d0117b4f98c99ac451a8f2011
---
.werks/4400 | 13 +++++++++++++
lib/store.py | 8 +++++++-
web/htdocs/crash_reporting.py | 1 +
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/.werks/4400 b/.werks/4400
new file mode 100644
index 0000000..f29c234
--- /dev/null
+++ b/.werks/4400
@@ -0,0 +1,13 @@
+Title: Fixed possible random "OSError: [Errno 9] Bad file descriptor" in GUI
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1488182205
+
+During rendering of any page in the GUI this error could occur. Restarting the
+apache of the site should be a workaround the issue for some time unitl applying
+the fix shipped with this change.
diff --git a/lib/store.py b/lib/store.py
index 8edf2ce..51f4c69 100644
--- a/lib/store.py
+++ b/lib/store.py
@@ -252,7 +252,13 @@ def release_all_locks():
global g_aquired_locks, g_locked_paths
for _unused_path, fd in g_aquired_locks:
- os.close(fd)
+ try:
+ os.close(fd)
+ except OSError, e:
+ if e.errno == 9: # OSError: [Errno 9] Bad file descriptor
+ pass
+ else:
+ raise
g_aquired_locks = []
g_locked_paths = []
diff --git a/web/htdocs/crash_reporting.py b/web/htdocs/crash_reporting.py
index 6236f47..d88a05f 100644
--- a/web/htdocs/crash_reporting.py
+++ b/web/htdocs/crash_reporting.py
@@ -151,6 +151,7 @@ def get_crash_info(tardata):
def fetch_file_from_tar(tardata, filename):
p = subprocess.Popen(['tar', 'xzf', '-',
'--to-stdout', filename],
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ stderr=open(os.devnull, "w"),
close_fds=True)
result = p.communicate(tardata)
return result[0]