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

Error when using gevent with allow_unsafe_werkzeug #2001

Closed
alethiophile opened this issue Jul 26, 2023 · 2 comments
Closed

Error when using gevent with allow_unsafe_werkzeug #2001

alethiophile opened this issue Jul 26, 2023 · 2 comments
Assignees
Labels

Comments

@alethiophile
Copy link

Describe the bug
When using gevent and gevent-websocket, if the allow_unsafe_werkzeug argument is passed to the SocketIO constructor, the server fails to start:

openakun-app-1       | Traceback (most recent call last):
openakun-app-1       |   File "src/gevent/greenlet.py", line 908, in gevent._gevent_cgreenlet.Greenlet.run
openakun-app-1       |   File "/venv/lib/python3.10/site-packages/gevent/baseserver.py", line 34, in _handle_and_close_when_done
openakun-app-1       |     return handle(*args_tuple)                                                                                                                                                                                        
openakun-app-1       |   File "/venv/lib/python3.10/site-packages/gevent/server.py", line 209, in wrap_socket_and_handle
openakun-app-1       |     with _closing_socket(self.wrap_socket(client_socket, **self.ssl_args)) as ssl_socket:                                                                                                                             
openakun-app-1       | TypeError: wrap_socket() got an unexpected keyword argument 'allow_unsafe_werkzeug'      
openakun-app-1       | 2023-07-26T17:28:56Z <Greenlet at 0x7f1915236480: _handle_and_close_when_done(<bound method StreamServer.wrap_socket_and_handle , <bound method StreamServer.do_close of <WSGIServer, (<gevent._socket3.socket [closed
] at 0x7f19168a5ea)> failed with TypeError                                                                                                                                                                                                   openakun-app-1       |                    

To Reproduce
Steps to reproduce the behavior:

  1. Install gevent and gevent-websocket
  2. Run socketio with the allow_unsafe_werkzeug option
  3. note crash

Expected behavior
If the server is going to be using gevent anyway, it should just ignore allow_unsafe_werkzeug, since the werkzeug server never comes into it.

@miguelgrinberg
Copy link
Owner

Can I ask you to install the main branch and confirm that the bug is addressed with the above commit? Thanks.

@miguelgrinberg miguelgrinberg self-assigned this Jul 26, 2023
@alethiophile
Copy link
Author

Yeah, it works fine now.

Thanks.

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

2 participants