Skip to content
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

Bot can hang in SSL reading inside Telegram library code #24

Open
Jaakkonen opened this issue Oct 20, 2023 · 0 comments
Open

Bot can hang in SSL reading inside Telegram library code #24

Jaakkonen opened this issue Oct 20, 2023 · 0 comments

Comments

@Jaakkonen
Copy link
Member

On 2023-10-20 the bot was stuck in following stacktrace when checked with py-spy

Collecting samples from 'python -m kiltisbot.bot' (python v3.11.3)
Total Samples 800
Collecting samples from 'python -m kiltisbot.bot' (python v3.11.3)
Total Samples 957
GIL: 0.00%, Active: 400.00%, Threads: 4

  %Own   %Total  OwnTime  TotalTime  Function (filename)                                          
300.00% 300.00%   28.71s    28.71s   _worker (concurrent/futures/thread.py)
100.00% 100.00%    9.57s     9.57s   read (ssl.py)
  0.00% 100.00%   0.000s     9.57s   __run (telegram/ext/_application.py)
  0.00% 100.00%   0.000s     9.57s   _safe_read (http/client.py)
  0.00% 100.00%   0.000s     9.57s   _run_once (asyncio/base_events.py)
  0.00% 100.00%   0.000s     9.57s   get (requests/api.py)
  0.00% 100.00%   0.000s     9.57s   check_messages (fiirumi/__init__.py)
  0.00% 100.00%   0.000s     9.57s   _handle_chunk (urllib3/response.py)
  0.00% 300.00%   0.000s    28.71s   _bootstrap (threading.py)
  0.00% 100.00%   0.000s     9.57s   readinto (socket.py)
  0.00% 300.00%   0.000s    28.71s   _bootstrap_inner (threading.py)
  0.00% 100.00%   0.000s     9.57s   _run (asyncio/events.py)
  0.00% 100.00%   0.000s     9.57s   run_forever (asyncio/base_events.py)
  0.00% 100.00%   0.000s     9.57s   run_polling (telegram/ext/_application.py)
  0.00% 100.00%   0.000s     9.57s   request (requests/sessions.py)
  0.00% 100.00%   0.000s     9.57s   read_chunked (urllib3/response.py)
  0.00% 100.00%   0.000s     9.57s   stream (urllib3/response.py)
  0.00% 100.00%   0.000s     9.57s   _run (telegram/ext/_jobqueue.py)
  0.00% 100.00%   0.000s     9.57s   _run_module_as_main (<frozen runpy>)
  0.00% 100.00%   0.000s     9.57s   recv_into (ssl.py)
  0.00% 100.00%   0.000s     9.57s   <module> (bot.py)
  0.00% 100.00%   0.000s     9.57s   request (requests/api.py)
  0.00% 100.00%   0.000s     9.57s   generate (requests/models.py)
  0.00% 100.00%   0.000s     9.57s   content (requests/models.py)
  0.00% 300.00%   0.000s    28.71s   run (threading.py)
  0.00% 100.00%   0.000s     9.57s   send (requests/sessions.py)
  0.00% 100.00%   0.000s     9.57s   _run_code (<frozen runpy>)
  0.00% 100.00%   0.000s     9.57s   main (bot.py)
  0.00% 100.00%   0.000s     9.57s   get_posts_after (fiirumi/__init__.py)

I think this is a well known problem in the requests library and there are some timeout options that could be used to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant