Module: check_mk
Branch: master
Commit: e1a6a5092cfe086240c4561abe0673d948099e0c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e1a6a5092cfe08…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Mar 3 14:03:55 2012 +0100
Fix timeout bug in check rescheduling
This was in fact a timeout problem in the whole Livestatus
API hat had been introduced some weeks ago.
---
web/htdocs/actions.py | 3 +--
web/htdocs/livestatus.py | 5 +++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/actions.py b/web/htdocs/actions.py
index 20f76dd..9d91020 100644
--- a/web/htdocs/actions.py
+++ b/web/htdocs/actions.py
@@ -85,7 +85,6 @@ def action_reschedule():
last_check = row[0]
if last_check < now:
html.write("['TIMEOUT', 'Check not executed within %d
seconds']\n" % (config.reschedule_timeout))
-
else:
if service == "Check_MK":
# Passive services triggered by Check_MK often are updated
@@ -97,4 +96,4 @@ def action_reschedule():
except Exception, e:
html.live.set_only_sites()
- raise MKGeneralException("Cannot reschedule check: %s" % e)
+ raise MKGeneralException(_("Cannot reschedule check: %s") % e)
diff --git a/web/htdocs/livestatus.py b/web/htdocs/livestatus.py
index c5211ce..d498f83 100644
--- a/web/htdocs/livestatus.py
+++ b/web/htdocs/livestatus.py
@@ -246,6 +246,8 @@ class BaseConnection:
def receive_data(self, size):
result = ""
+ # Timeout is only honored when connecting
+ self.socket.settimeout(None)
while size > 0:
packet = self.socket.recv(size)
if len(packet) == 0:
@@ -320,6 +322,9 @@ class BaseConnection:
else:
raise MKLivestatusSocketError(str(e))
+ except Exception, e:
+ raise MKLivestatusSocketError("Unhandled exception: %s" % e)
+
def do_command(self, command):
if self.socket == None: