-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Milestone
Description
Steps to reproduce
- Start bot by using
telegram.ext.updater.start_polling()
- Wait for network errors
Expected behaviour
There should be some retry mechanism before stopping the whole bot
Actual behaviour
The bot stopped on network errors
Configuration
Ubuntu 16.04.2 LTS
Version of Python, python-telegram-bot & dependencies:
python-telegram-bot 5.3.1
urllib3 1.20
certifi 2017.04.17
future 0.16.0
Python 3.6.1 (default, Apr 22 2017, 20:17:23) [GCC 5.4.0 20160609]
Logs
2017-05-13 15:13:40,243 - telegram.ext.updater - ERROR - unhandled exception
Traceback (most recent call last):
File "/home/ghost/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 386, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/home/ghost/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 382, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3.6/ssl.py", line 1002, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.6/ssl.py", line 865, in read
return self._sslobj.read(len, buffer)
File "/usr/lib/python3.6/ssl.py", line 625, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ghost/.local/lib/python3.6/site-packages/telegram/ext/updater.py", line 115, in _thread_wrapper
target(*args, **kwargs)
File "/home/ghost/.local/lib/python3.6/site-packages/telegram/ext/updater.py", line 233, in _start_polling
self.last_update_id, timeout=timeout, network_delay=network_delay)
File "/home/ghost/.local/lib/python3.6/site-packages/telegram/bot.py", line 125, in decorator
result = func(self, *args, **kwargs)
File "/home/ghost/.local/lib/python3.6/site-packages/telegram/bot.py", line 1241, in getUpdates
result = self._request.post(url, data, timeout=urlopen_timeout)
File "/home/ghost/.local/lib/python3.6/site-packages/telegram/utils/request.py", line 207, in post
**urlopen_kwargs)
File "/home/ghost/.local/lib/python3.6/site-packages/telegram/utils/request.py", line 132, in _request_wrapper
resp = self._con_pool.request(*args, **kwargs)
File "/home/ghost/.local/lib/python3.6/site-packages/urllib3/request.py", line 70, in request
**urlopen_kw)
File "/home/ghost/.local/lib/python3.6/site-packages/urllib3/request.py", line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/home/ghost/.local/lib/python3.6/site-packages/urllib3/poolmanager.py", line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/home/ghost/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "/home/ghost/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/home/ghost/.local/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/home/ghost/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/ghost/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 388, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/home/ghost/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 308, in _raise_timeout
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=15.0)
2017-05-13 15:13:41,195 - telegram.ext.dispatcher - CRITICAL - stopping due to exception in another thread
vsmelov, MelomanCool and lossurdo