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

gevent.timeout.Timeout: 0.0 seconds #2006

Open
scottgigante opened this issue Nov 21, 2023 · 3 comments
Open

gevent.timeout.Timeout: 0.0 seconds #2006

scottgigante opened this issue Nov 21, 2023 · 3 comments

Comments

@scottgigante
Copy link

  • gevent version: 23.9.1 from PyPi
  • Python version: python 3.11.4 from docker image python:3.11.4-bookworm
  • Operating System: Debian GNU/Linux 12 (bookworm) from docker image python:3.11.4-bookworm

Description:

I am running django+gunicorn with gevent and getting seemingly random gevent timeouts with a timeout length of 0.0 seconds. It's unclear to me why this timeout is being set. Any help would be appreciated!

Exception ignored in: <finalize object at 0x7f7e1a8349a0; dead>
--
  | Traceback (most recent call last):
  | File "/usr/local/lib/python3.11/weakref.py", line 590, in __call__
  | return info.func(*info.args, **(info.kwargs or {}))
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  | File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1179, in _close_pool_connections
  | conn = pool.get(block=False)
  | ^^^^^^^^^^^^^^^^^^^^^
  | File "/usr/local/lib/python3.11/queue.py", line 182, in get
  | self.not_full.notify()
  | File "/usr/local/lib/python3.11/threading.py", line 369, in notify
  | if not self._is_owned():
  | ^^^^^^^^^^^^^^^^
  | File "/usr/local/lib/python3.11/threading.py", line 282, in _is_owned
  | if self._lock.acquire(False):
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
  | File "/usr/local/lib/python3.11/site-packages/gevent/thread.py", line 132, in acquire
  | sleep()
  | File "/usr/local/lib/python3.11/site-packages/gevent/hub.py", line 159, in sleep
  | waiter.get()
  | File "src/gevent/_waiter.py", line 143, in gevent._gevent_c_waiter.Waiter.get
  | File "src/gevent/_waiter.py", line 154, in gevent._gevent_c_waiter.Waiter.get
  | File "src/gevent/_greenlet_primitives.py", line 61, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch
  | File "src/gevent/_greenlet_primitives.py", line 61, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch
  | File "src/gevent/_greenlet_primitives.py", line 65, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch
  | File "src/gevent/_gevent_c_greenlet_primitives.pxd", line 35, in gevent._gevent_c_greenlet_primitives._greenlet_switch
  | gevent.timeout.Timeout: 0.0 seconds

What I've run:

Not able to create a MRE unfortunately, but this is how I run gunicorn.

exec gunicorn <my_app> \
--name my_app \
--workers 3 \
--worker-class gevent \
--timeout 120 \
--bind=unix:/usr/var/run/gunicorn.sock \
--log-level=warning \
--log-file=-
@SmallPineApp1e
Copy link

Same exception occurred on me

@rconroy293
Copy link

I'm seeing something similar in a Gunicorn / Flask / SQLAlchemy / PyMySQL setup on Python 3.11.7. Package versions:

Flask==2.2.5
gevent==23.9.1
greenlet==3.0.1
gunicorn==21.2.0
PyMySQL==1.1.0
SQLAlchemy==2.0.23

Stack trace is below:

Exception during reset or similar
Traceback (most recent call last):
  File "/path/to/some-virtualenv-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 988, in _finalize_fairy
    fairy._reset(
  File "/path/to/some-virtualenv-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 1438, in _reset
    pool._dialect.do_rollback(self)
  File "/path/to/some-virtualenv-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 692, in do_rollback
    dbapi_connection.rollback()
  File "/path/to/some-virtualenv-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 488, in rollback
    self._read_ok_packet()
  File "/path/to/some-virtualenv-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 448, in _read_ok_packet
    pkt = self._read_packet()
          ^^^^^^^^^^^^^^^^^^^
  File "/path/to/some-virtualenv-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 739, in _read_packet
    packet_header = self._read_bytes(4)
                    ^^^^^^^^^^^^^^^^^^^
  File "/path/to/some-virtualenv-py3.11/lib/python3.11/site-packages/pymysql/connections.py", line 779, in _read_bytes
    data = self._rfile.read(num_bytes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/some-virtualenv-py3.11/lib/python3.11/site-packages/gevent/_socketcommon.py", line 696, in recv_into
    self._wait(self._read_event)
  File "src/gevent/_hub_primitives.py", line 317, in gevent._gevent_c_hub_primitives.wait_on_socket
  File "src/gevent/_hub_primitives.py", line 322, in gevent._gevent_c_hub_primitives.wait_on_socket
  File "src/gevent/_hub_primitives.py", line 304, in gevent._gevent_c_hub_primitives._primitive_wait
  File "src/gevent/_hub_primitives.py", line 46, in gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.wait
  File "src/gevent/_hub_primitives.py", line 46, in gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.wait
  File "src/gevent/_hub_primitives.py", line 55, in gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.wait
  File "src/gevent/_waiter.py", line 154, in gevent._gevent_c_waiter.Waiter.get
  File "src/gevent/_greenlet_primitives.py", line 61, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch
  File "src/gevent/_greenlet_primitives.py", line 61, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch
  File "src/gevent/_greenlet_primitives.py", line 65, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch
  File "src/gevent/_gevent_c_greenlet_primitives.pxd", line 35, in gevent._gevent_c_greenlet_primitives._greenlet_switch
gevent.timeout.Timeout: 0.0 seconds

Any insight is much appreciated!

@DDUFlyme
Copy link

DDUFlyme commented Mar 5, 2024

Hi, does anyone knows how to figure out this problem?

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

4 participants