Fix occasional crashes in python plugins
Occasionally python plugins such as the nginx plugin crash with ``` Exception in thread local: Traceback (most recent call last): File "/usr/lib64/python3.4/threading.py", line 911, in _bootstrap_inner self.run() File "/usr/libexec/netdata/python.d/python_modules/base.py", line 166, in run time.sleep(self.timetable['next'] - time.time()) ValueError: sleep length must be non-negative ``` Afterwards no further data is collected for the plugin until netdata is restarted
Magnus Kessler committed
Oct 27, 2016 at 10:02 UTC
72b9c272ccf38782bf6fbcc98810e66ae376a46b
1 file changed
+1
-1
python.d/python_modules/base.py
+1
-1
@@ -163,7 +163,7 @@ class SimpleService(threading.Thread):
163
self.error("Something wrong: ", str(e))
164
return
165
if status: # handle retries if update failed
166
- time.sleep(self.timetable['next'] - time.time())
166
+ time.sleep(max (0, self.timetable['next'] - time.time()))
167
self.retries_left = self.retries
168
else:
169
self.retries_left -= 1