pyTelegramBotAPI icon indicating copy to clipboard operation
pyTelegramBotAPI copied to clipboard

ERROR - TeleBot: "ConnectionError occurred, args=(ProtocolError('Connection aborted.', TimeoutError(110, 'Connection timed out')),)

Open toxidxd opened this issue 8 years ago • 34 comments

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

  1. What version of pyTelegramBotAPI are you using? Name: pyTelegramBotAPI Version: 3.5.2

  2. What OS are you using? Linux Mint 18.2

  3. What version of python are you using? Python 3.5.2

toxidxd avatar Jan 29 '18 11:01 toxidxd

Is it always happen? It seems network problem between your device and telegram bot api server.

eternnoir avatar Feb 06 '18 02:02 eternnoir

Same here after like an 10 min bot gets disconnected help pls

eatbas avatar Feb 07 '18 16:02 eatbas

@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 avatar Feb 10 '18 08:02 eatbas

@eatbas It seems like network problem not package problem. Try some vps to test it.

eternnoir avatar Feb 15 '18 04:02 eternnoir

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.

i3wangyi avatar Feb 27 '18 22:02 i3wangyi

Had the same problem!!!

python 3.6 pyTrlrgramBotAPI - latest

webhook (flask) as in example: https://github.com/eternnoir/pyTelegramBotAPI/blob/master/examples/webhook_examples/webhook_flask_echo_bot.py

CentOS7 Host on - Google cloud service (Virtual Mashine)

If i don`t speak with my bot above 15min it 'sleep' and the first message give this error Mar 13 11:08:09 instance-1 python3.6[15983]: 2018-03-13 11:08:09,872 (util.py:65 WorkerThread1) ERROR - TeleBot: "ConnectionError occurred, args=(ProtocolError('Connect ion aborted.', ConnectionResetError(104, 'Connection reset by peer')),) ....... ConnectionError(err, request=request) Mar 13 11:08:09 instance-1 python3.6[15983]: requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) Mar 13 11:08:09 instance-1 python3.6[15983]: "

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 -

AInsane avatar Mar 13 '18 11:03 AInsane

Same as above. Tested on GCE Ubuntu 18.04

Stihotvor avatar Sep 11 '18 07:09 Stihotvor

+1, after 10-15 min: (util.py:65 WorkerThread2) ERROR - TeleBot: "ConnectionError occurred, args=(ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')),)

jekeam avatar Apr 17 '19 08:04 jekeam

+1

haliliceylan avatar Aug 16 '19 18:08 haliliceylan

+1

aever32 avatar Aug 20 '19 12:08 aever32

+1

hieupmse05244 avatar Aug 29 '19 08:08 hieupmse05244

+1

fira42073 avatar Sep 06 '19 17:09 fira42073

Hi same here but 104

requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

no solution yet? I mean for me it working perfect while running on my private pc but on gcloud it just happen all the time this error

EDIT found that it was happen to me only on gcloud vm instance, moved to aws and everything is perfect. something wrong with google and requests lib take care

LiadBarnes avatar Sep 10 '19 22:09 LiadBarnes

I have the issue too. I work on Google DataLab and use telebot lib. It happen just about after 10 minutes. I don't use requests lib

YurkaGagarin avatar Sep 13 '19 22:09 YurkaGagarin

+1. This happens when I try to send a voice message.

ghost avatar Oct 04 '19 08:10 ghost

Solved the problem by sending a smaller file)))).

ghost avatar Oct 04 '19 09:10 ghost

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?

TahirJalilov avatar Oct 05 '19 06:10 TahirJalilov

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')

YurkaGagarin avatar Oct 07 '19 14:10 YurkaGagarin

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?

TahirJalilov avatar Oct 07 '19 17:10 TahirJalilov

Maybe we can handle exception with callback? Idk, actually, I got no time nowOn Oct 7, 2019 9:34 PM, Tahir Jalilov [email protected] 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.

fira42073 avatar Oct 07 '19 17:10 fira42073