Skip to content

[BUG] Bot stops making requests to Telegram's getUpdates endpoint #4069

Description

@Jazpy

Steps to Reproduce

  1. Run the application using the following snippet:
async def start(self, update, context):
    await context.bot.send_message(chat_id=update.effective_chat.id, text="<3")

token = 'xxx'
app   = ApplicationBuilder()         \
    .get_updates_http_version('1.1') \
    .http_version('h.h')             \
    .token(token)                    \
    .build()
start_handler = CommandHandler('start', start)
app.add_handler(start_handler)
app.run_polling()
  1. Wait for up to a week, bot will eventually stop polling for updates, even though the python process is running without errors.

Expected behaviour

I would expect the bot to continue polling for updates indefinitely.

Actual behaviour

The bot will correctly poll for updates for a long time, up to a week:

2023-12-01 19:33:20,031 - httpx - INFO - HTTP Request: POST https://api.telegram.org/xxx/getUpdates "HTTP/1.1 200 OK"
2023-12-01 19:33:30,240 - httpx - INFO - HTTP Request: POST https://api.telegram.org/xxx/getUpdates "HTTP/1.1 200 OK"
2023-12-01 19:33:40,453 - httpx - INFO - HTTP Request: POST https://api.telegram.org/xxx/getUpdates "HTTP/1.1 200 OK"
2023-12-01 19:33:50,651 - httpx - INFO - HTTP Request: POST https://api.telegram.org/xxx/getUpdates "HTTP/1.1 200 OK"
2023-12-01 19:34:00,924 - httpx - INFO - HTTP Request: POST https://api.telegram.org/xxx/getUpdates "HTTP/1.1 200 OK"
2023-12-01 19:34:11,127 - httpx - INFO - HTTP Request: POST https://api.telegram.org/xxx/getUpdates "HTTP/1.1 200 OK"
2023-12-01 19:34:21,324 - httpx - INFO - HTTP Request: POST https://api.telegram.org/xxx/getUpdates "HTTP/1.1 200 OK"

Eventually however, it will simply stop making requests without any errors:

2024-01-14 18:56:48,741 - httpx - INFO - HTTP Request: POST https://api.telegram.org/xxx/getUpdates "HTTP/1.1 200 OK"
2024-01-14 18:56:58,943 - httpx - INFO - HTTP Request: POST https://api.telegram.org/xxx/getUpdates "HTTP/1.1 200 OK"
2024-01-14 18:57:09,144 - httpx - INFO - HTTP Request: POST https://api.telegram.org/xxx/getUpdates "HTTP/1.1 200 OK"
[EOF]

For some reason the python telegram bot remains sleeping even though there should be an interrupt waking it to check for more updates:

$ sudo strace -p PID
strace: Process PID attached
epoll_wait(3,

$ ps ax 746
PID ?        Sl     3:06 python /home/bot.py

Operating System

Raspbian GNU/Linux 11 (bullseye)

Version of Python, python-telegram-bot & dependencies

python-telegram-bot 20.5
Bot API 6.8
Python 3.9.2 (default, Mar 12 2021, 04:06:34)  [GCC 10.2.1 20210110]

Relevant log output

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions