Skip to content
This repository was archived by the owner on Sep 13, 2024. It is now read-only.
This repository was archived by the owner on Sep 13, 2024. It is now read-only.

Assertion fails in ReadTransport when used in conjunction with python-telegram-bot #73

@arbu

Description

@arbu

Describe the bug

When using python-telegram-bot with gbulb installed, a stacktrace in gbulbs transport.py will be logged on some of the API calls. The bot continues to poll for updates. From my limited tests, all the messages seem to be successfully received as well. So for my case this is not really an error. But if the incoming connection is not fully consumed, this might have an impact on other applications though.

Steps to reproduce

Get a telegram bot token and run the following minimal telegram bot with the TELEGRAM_TOKEN env set to the token:

import gbulb

gbulb.install()

import os
import logging
import signal
from telegram.ext import ApplicationBuilder

logging.basicConfig(
    format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.DEBUG
)

if __name__ == "__main__":
    application = ApplicationBuilder().token(os.environ.get("TELEGRAM_TOKEN")).build()

    application.run_polling(stop_signals=(signal.SIGINT, signal.SIGTERM))

An AssertionError in ReadTransport._loop_reading will be logged

Expected behavior

No error message

Screenshots

No response

Environment

  • Operating System: Arch Linux
  • Python version: 3.10
  • Software versions (installed via pipenv):
    • gbulb 0.6.4
    • python-telegram-bot 20.2

Logs

2023-03-26 19:07:46,941 - telegram.ext._updater - DEBUG - Start network loop retry getting Updates
2023-03-26 19:07:46,941 - telegram._bot - DEBUG - Entering: get_updates
2023-03-26 19:07:46,942 - telegram.ext._application - INFO - Application started
2023-03-26 19:07:46,989 - asyncio - ERROR - Exception in callback ReadTransport._loop_reading(<Future finis...1cL9)\xcd\\P'>)
handle: <GLibHandle ReadTransport._loop_reading(<Future finis...1cL9)\xcd\\P'>)>
Traceback (most recent call last):
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/aaron/.local/share/virtualenvs/gbulb-test-tg-bot-qwCEH6Yd/lib/python3.10/site-packages/gbulb/transports.py", line 141, in _loop_reading
    self._read_fut is None and self._closing
AssertionError

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA crash or error in behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions