-
-
Notifications
You must be signed in to change notification settings - Fork 889
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
Random OSError: headers already sent, with gevent_uwsgi #377
Comments
Is there always a |
@miguelgrinberg, thank you for your replay. I found that the OSError always appears when the client disconnect the connection. |
Before you said that the error appeared randomly, though. Are you sure it is only when a client disconnects? The log that you copied above does not suggest the client willingly disconnected, my interpretation is that uWSGI disconnected the user for some reason, so I want to try to figure out what made it break that connection. |
I cant find other error in the log. Well, I dont know the no PONG received in 3 seconds !!! is from uwsgi or others, but i think it may let the server disconnect the connection because there is no PING signal. I set the web emit my_ping signal in 1s, it also has no PONG received in 3 seconds !!! and the OSerror.
|
I got the same error running a socket io server via uwsgi.
uwsgi --http :8080 --http-raw-body --gevent 3000 --gevent-monkey-patch --master --http-websockets -w backend.wsgi |
Same for me, when the client disconnect I get the error
The settings I'm using are the ones suggested on the flask_socketio page: |
@andreatulimiero This is a fairly common problem with WebSocket connections. When the connection ends, the server tries to end the request like a normal HTTP request under WSGI, by sending an HTTP response. But WebSocket works in a different way and the way to end requests is different. The code should have recognized that this was a WebSocket request and handle it appropriately, but apparently it isn't. This should not cause any problems to your application, besides the annoying error every time a client disconnects. |
Please upgrade package python-engineio and let me know if this problem still occurs. It now works fine for me, so I'm hopeful. |
@miguelgrinberg after the upgrade is working like a charm ! |
Hello there,
I began to use Flask-SocketIO today. When i test the example/app.py with uwsgi, I randomly get an OSError: headers already sent
The log is below:
I test several times, but it seems the Error appears randomly.
The command I used to run the example:
uwsgi --http :8080 --gevent 1000 --http-websockets --master --wsgi-file app_origin.py --callable app -H ~/hospital_server/env_hospital/
The text was updated successfully, but these errors were encountered: