A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/eternnoir/pyTelegramBotAPI/issues/1058 below:

Bot does not recover properly when using infinity_polling · Issue #1058 · eternnoir/pyTelegramBotAPI · GitHub

  1. What version of pyTelegramBotAPI are you using? 3.7.4

  2. What OS are you using? Raspbian

  3. What version of python are you using? 3.6.9

Testing out bot.infinity_polling() as recommended in #1057 I noticed a bug in the recovery from exceptions:

It seems like the bot does not recover completely from a collision from another bot instance. It crashes and restarts successfully, which is nice, but it seems to get stuck in a restart loop every 3s (sleep time on recovery). I would guess there is an implicit state that carries over the restart that still contains the cancel instruction, but I haven't found anything obvious.

This bug can be bypassed by not starting another instance with the same token, but I assume that the same bug will also strike with other exceptions, unrelated to this cause.

Reproduction:

  1. Start instance 1 with bot.infinity_polling() and logging.INFO
  2. Start another instance to provoke a collision
  3. stop second bot to allow instance 1 to run
  4. -> instance 1 has crashed and is stuck in restart loop afterwards

log instance 1:

2020-12-31 16:03:07,705 (__init__.py:460 MainThread) INFO - TeleBot: "Started polling."
2020-12-31 16:19:07,961 (__init__.py:489 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 409. Description: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"
2020-12-31 16:19:07,961 (__init__.py:496 MainThread) INFO - TeleBot: "Waiting for 0.25 seconds until retry"
2020-12-31 16:19:11,546 (__init__.py:489 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 409. Description: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"
2020-12-31 16:19:11,546 (__init__.py:496 MainThread) INFO - TeleBot: "Waiting for 0.5 seconds until retry"
2020-12-31 16:42:57,901 (__init__.py:460 MainThread) INFO - TeleBot: "Started polling."
2020-12-31 16:43:00,905 (__init__.py:460 MainThread) INFO - TeleBot: "Started polling."
2020-12-31 16:43:03,908 (__init__.py:460 MainThread) INFO - TeleBot: "Started polling."
2020-12-31 16:43:06,914 (__init__.py:460 MainThread) INFO - TeleBot: "Started polling."
2020-12-31 16:43:09,920 (__init__.py:460 MainThread) INFO - TeleBot: "Started polling."

log instance 2:

2020-12-31 16:19:07,872 (__init__.py:460 MainThread) INFO - TeleBot: "Started polling."
2020-12-31 16:19:11,256 (__init__.py:489 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 409. Description: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"
2020-12-31 16:19:11,256 (__init__.py:496 MainThread) INFO - TeleBot: "Waiting for 0.25 seconds until retry"

Process finished with exit code -1

PS: Happy new year and thanks for the fast responses!

lsddelux, EVOLUTION666 and UngeheurenUngeziefer


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4