querybook icon indicating copy to clipboard operation
querybook copied to clipboard

Hotfix: version fix on python-engineio to debug uWSGI socket issue

Open okayhooni opened this issue 1 year ago • 1 comments

fix: https://github.com/pinterest/querybook/issues/1319 related to: https://github.com/miguelgrinberg/python-engineio/issues/330

python-engineio (version between v4.5.1 and v4.7.0) has some bug on socket close logic.

Due to this issue, Querybook webserver got the error below all the time.

Traceback (most recent call last):
  File "src/gevent/greenlet.py", line 906, in gevent._gevent_cgreenlet.Greenlet.run
  File "/usr/local/lib/python3.9/site-packages/engineio/socket.py", line 223, in writer
    ws.close()
  File "/usr/local/lib/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-01T11:35:50Z <Thread at 0x7f63a8909040: writer> failed with SystemError

Traceback (most recent call last):
  File "src/gevent/greenlet.py", line 831, in gevent._gevent_cgreenlet.Greenlet.join
  File "src/gevent/greenlet.py", line 857, in gevent._gevent_cgreenlet.Greenlet.join
  File "src/gevent/greenlet.py", line 846, 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 906, in gevent._gevent_cgreenlet.Greenlet.run
  File "/usr/local/lib/python3.9/site-packages/engineio/socket.py", line 223, in writer
    ws.close()
  File "/usr/local/lib/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

This issue has been solved by python-engineio version 4.7.1 (released just 5 hours ago).

I deployed and tested Querybook with this version, and the issue was solved.

okayhooni avatar Sep 12 '23 16:09 okayhooni

@okayhooni looks like querybook doesn't directly depend on python-engineio. And I checked the version of python-engineio when running make, it is python-engineio 4.9.0. Is it still an issue on your end if without this PR?

jczhong84 avatar Feb 25 '24 06:02 jczhong84