@cryptotaxi247 / netdata-1 / commits / bd67875f2

fix some timeout issues

paulfantom committed Jun 22, 2016 at 20:40 UTC bd67875f26d7f5e7cea7c77a451b27c47b8d000b
5 files changed +20 -7
plugins.d/python.d.plugin
+4 -1
@@ -477,7 +477,10 @@ class PythonCharts(object):
477 i += 1
478 if len(next_runs) == 0:
479 fatal('no python.d modules loaded.')
480 - time.sleep(min(next_runs) - time.time())
480 + try:
481 + time.sleep(min(next_runs) - time.time())
482 + except IOError:
483 + pass
484
485
486 def read_config(path):
python.d/apache.chart.py
+4 -1
@@ -102,7 +102,10 @@ class Service(UrlService):
102 Format data received from http request
103 :return: dict
104 """
105 - raw = self._get_data().split("\n")
105 + try:
106 + raw = self._get_data().split("\n")
107 + except AttributeError:
108 + return None
109 data = {}
110 for row in raw:
111 tmp = row.split(":")
python.d/nginx.chart.py
+2 -2
@@ -67,8 +67,8 @@ class Service(UrlService):
67 Format data received from http request
68 :return: dict
69 """
70 - raw = self._get_data().split(" ")
70 try:
71 + raw = self._get_data().split(" ")
72 return {'active': int(raw[2]),
73 'requests': int(raw[7]),
74 'reading': int(raw[11]),
@@ -76,5 +76,5 @@ class Service(UrlService):
76 'waiting': int(raw[15]),
77 'accepts': int(raw[8]),
78 'handled': int(raw[9])}
79 - except ValueError:
79 + except (ValueError, AttributeError):
80 return None
python.d/phpfpm.chart.py
+4 -1
@@ -68,7 +68,10 @@ class Service(UrlService):
68 Format data received from http request
69 :return: dict
70 """
71 - raw = self._get_data().split('\n')
71 + try:
72 + raw = self._get_data().split('\n')
73 + except AttributeError:
74 + return None
75 data = {}
76 for row in raw:
77 tmp = row.split(":")
python.d/python_modules/base.py
+6 -2
@@ -123,13 +123,17 @@ class UrlService(BaseService):
123 Get raw data from http request
124 :return: str
125 """
126 + raw = None
127 try:
128 f = urlopen(self.url, timeout=self.update_every)
129 raw = f.read().decode('utf-8')
129 - f.close()
130 except Exception as e:
131 self.error(self.__module__, str(e))
132 - return None
132 + finally:
133 + try:
134 + f.close()
135 + except:
136 + pass
137 return raw
138
139 def _formatted_data(self):