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

Bug disconnection with uwsgi #330

Closed
johaven opened this issue Sep 6, 2023 · 7 comments
Closed

Bug disconnection with uwsgi #330

johaven opened this issue Sep 6, 2023 · 7 comments
Assignees
Labels

Comments

@johaven
Copy link

johaven commented Sep 6, 2023

Versions:
Flask-SocketIO 5.3.5
python-engineio 4.6.1
python-socketio 5.8.0
gevent 23.7.0
greenlet 2.0.2
uWSGI 2.0.22

Error during disconnection:

[uwsgi-websocket] "GET /socket.io/?EIO=4&transport=websocket" no PONG received in 3 seconds !!!
[BUG] current_wsgi_req NOT FOUND !!!
Traceback (most recent call last):
  File "src/gevent/greenlet.py", line 908, in gevent._gevent_cgreenlet.Greenlet.run
  File "/var/www/webapp/venv/lib64/python3.9/site-packages/engineio/socket.py", line 223, in writer
    ws.close()
  File "/var/www/webapp/venv/lib64/python3.9/site-packages/engineio/async_drivers/gevent_uwsgi.py", line 70, in close
    uwsgi.disconnect()
SystemError: you can call uwsgi api function only from the main callable
2023-09-06T08:59:59Z <Thread at 0x7febf566dae0: writer> failed with SystemError

Traceback (most recent call last):
  File "src/gevent/greenlet.py", line 833, in gevent._gevent_cgreenlet.Greenlet.join
  File "src/gevent/greenlet.py", line 859, in gevent._gevent_cgreenlet.Greenlet.join
  File "src/gevent/greenlet.py", line 848, in gevent._gevent_cgreenlet.Greenlet.join
  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
  File "src/gevent/greenlet.py", line 908, in gevent._gevent_cgreenlet.Greenlet.run
  File "/var/www/webapp/venv/lib64/python3.9/site-packages/engineio/socket.py", line 223, in writer
    ws.close()
  File "/var/www/webapp/venv/lib64/python3.9/site-packages/engineio/async_drivers/gevent_uwsgi.py", line 70, in close
    uwsgi.disconnect()
SystemError: you can call uwsgi api function only from the main callable

Seems to be related to:

unbit/uwsgi#985
pinterest/querybook#1319

@miguelgrinberg miguelgrinberg self-assigned this Sep 6, 2023
@stianpr
Copy link

stianpr commented Sep 6, 2023

We've been having similar issues with this:

Versions:
Flask-SocketIO 5.3.1
python-engineio 4.6.1 (and 4.7.0 after latest deploy)
python-socketio 5.9.0
gevent 22.10.2
greenlet 2.0.1
uWSGI 2.0.21

Exception:

SystemError: you can call uwsgi api function only from the main callable
  File "src/gevent/greenlet.py", line 833, in gevent._gevent_cgreenlet.Greenlet.join
  File "src/gevent/greenlet.py", line 859, in gevent._gevent_cgreenlet.Greenlet.join
  File "src/gevent/greenlet.py", line 848, in gevent._gevent_cgreenlet.Greenlet.join
  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
  File "src/gevent/greenlet.py", line 908, in gevent._gevent_cgreenlet.Greenlet.run
  File "engineio/socket.py", line 223, in writer
    ws.close()
  File "engineio/async_drivers/gevent_uwsgi.py", line 70, in close
    uwsgi.disconnect()

@stianpr
Copy link

stianpr commented Sep 11, 2023

Any updates on this?

@amks1
Copy link

amks1 commented Sep 11, 2023

I have the same issue, python-engineio v4.5.1 is the latest version I'm able to run that doesn't give the above error.

@miguelgrinberg
Copy link
Owner

Could you test the main branch to confirm the problem is gone? Thanks.

@amks1
Copy link

amks1 commented Sep 11, 2023

Could you test the main branch to confirm the problem is gone? Thanks.

Yes, the problem seems to be fixed in the main branch now. 👍

@miguelgrinberg
Copy link
Owner

4.7.1 is out with this fix.

@okayhooni
Copy link

@johaven
Thank you for noticing me this issue with mention. :)

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

No branches or pull requests

5 participants