-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR - TeleBot: "ConnectionError occurred, args=(ProtocolError('Connection aborted.', TimeoutError(110, 'Connection timed out')),) #453
Comments
Is it always happen? It seems network problem between your device and telegram bot api server. |
Same here after like an 10 min bot gets disconnected help pls |
@eternnoir hello man it happens all the time for me. If i leave the bot un attended like 10 min. I instantly get this error. I am using latest version of the bot, windows 10 pycharm and python version 3.5.2 waiting for your answer. I can send the code if you like mostly I am using bot.register_next_step_handler(msg, trade_type_step) Waiting for your reply. |
@eatbas It seems like network problem not package problem. Try some vps to test it. |
It's always happening on my side as well, I feel like polling method doesn't handle the network failure exception properly (as it only catches ApiException and KeyBoardInterrupt exception) , at least allow several retries is needed. |
Had the same problem!!! python 3.6 webhook (flask) as in example: https://github.com/eternnoir/pyTelegramBotAPI/blob/master/examples/webhook_examples/webhook_flask_echo_bot.py CentOS7 If i don`t speak with my bot above 15min it 'sleep' and the first message give this error And wit the next messages - everything OK! Mar 13 11:08:13 instance-1 python3.6[15983]: 149.154.167.226 - - [13/Mar/2018 11:08:13] "POST /TOKEN/ HTTP/1.1" 200 - |
Same as above. Tested on GCE Ubuntu 18.04 |
+1, after 10-15 min: |
+1 |
3 similar comments
+1 |
+1 |
+1 |
Hi same here but 104 requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) no solution yet? EDIT |
I have the issue too. |
+1. This happens when I try to send a voice message. |
Solved the problem by sending a smaller file)))). |
Hello, the same problem for my bit in google cloud vm. Previously my bot was on hetzner and everything was good. Does anyone know how to automatically restart bot if i catch this error? |
I solved the issue by following function:
|
well, as I understood you try to catch OSError every time during sending a message. Correct? |
Maybe we can handle exception with callback? Idk, actually, I got no time nowOn Oct 7, 2019 9:34 PM, Tahir Jalilov <notifications@github.com> wrote:
I solved the issue by following function:
def solver(text):
try:
msg = InvestingcomPythonEchoBot.send_message(chat_id=XXXXXXXXXXXXXXX, text=text)
except OSError:
msg = InvestingcomPythonEchoBot.send_message(chat_id=XXXXXXXXXXXXXXX, text=text)
solver('Problem solved')
well, as I understood you try to catch OSError every time during sending a message. Correct?
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.
|
I did like that:
Then I did testing with continuously sending a lot of messages to the bot and everything looks good. |
also, you can create cron job which will be check if a bot is not running, start bot |
I use supervisor for it. U can bind all the things on itOn Oct 8, 2019 8:35 PM, Tahir Jalilov <notifications@github.com> wrote:also, you can create cron job which will be check if a bot is not running, start bot
*/1 * * * * ps -aux | grep grep -v |grep bot.py > /home/user/cronresult.txt || python3 /home/user/TelegramBot/bot.py -args0 -args1
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.
|
I have the same problem on Google Compute Engine + Debian 9 + pyTelegramBotAPI 3.7.1 |
My solution:
|
I also faced to this issue.any solution? |
But when to call this function?
Like I understood the code, but when should I call this function? Can anybody send an example? |
I had the same issue. I adapted this solution to my requirements and worked very well.
Thank you!!! |
None of these solutions helped .. every 10-15 minutes of inactivity connection rushes with an error =( "Connectionerror Occurred, Args = (Protocolerror ('Connection ABORTED.", ConnectionReseTerror (104,' Connection Reset by Peer '))) |
Have you solved? I'm having the same issue. |
I have the same problem on Google Compute Engine + Debian 10 + pyTelegramBotAPI 3.8.2 |
Why it is closed? What is the cause of it? Wrong default poll interval? @eternnoir |
I guess we can tune connection pool to solve this. |
Why |
esse erro é citado em: eternnoir/pyTelegramBotAPI#453. a alteração faz o bot se auto reiniciar em caso exeção
2018-01-29 08:32:07,077 (util.py:64 WorkerThread1) ERROR - TeleBot: "ConnectionError occurred, args=(ProtocolError('Connection aborted.', TimeoutError(110, 'Connection timed out')),)
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 560, in urlopen
body=body, headers=headers)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.5/http/client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python3.5/http/client.py", line 1151, in _send_request
self.endheaders(body)
File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders
self._send_output(message_body)
File "/usr/lib/python3.5/http/client.py", line 936, in _send_output
self.send(message_body)
File "/usr/lib/python3.5/http/client.py", line 908, in send
self.sock.sendall(data)
File "/usr/lib/python3.5/ssl.py", line 891, in sendall
v = self.send(data[count:])
File "/usr/lib/python3.5/ssl.py", line 861, in send
return self._sslobj.write(data)
File "/usr/lib/python3.5/ssl.py", line 586, in write
return self._sslobj.write(data)
TimeoutError: [Errno 110] Connection timed out
What version of pyTelegramBotAPI are you using?
Name: pyTelegramBotAPI
Version: 3.5.2
What OS are you using?
Linux Mint 18.2
What version of python are you using?
Python 3.5.2
The text was updated successfully, but these errors were encountered: