-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
Couldn't upgrade the protocol in some random cases #160
Comments
I have exactly the same issue and did the same investigation at the same time.
You can't control the order of the processing of the packets in the client, but in the javascript version of engine.io, the protocol seems to work even if the handling of NOOP and PONG are reversed. I believe this is the logic that is missing from the original implementation: https://github.com/socketio/engine.io/blob/cb0ac6fddcad12c454651bf0e1a312a154e228a4/lib/transports/polling.js#L112-L117 Immediatly sending noop to the poll request that is sent after the first noop is critical to finish the upgrade (It will trigger the event expected after your log As this causes a business critical issue for me, I am ready to open a PR by tomorrow if you think this is the right way to do this @miguelgrinberg (EDIT: opened here: #161) |
I can see that there is this PR => https://github.com/miguelgrinberg/python-engineio/pull/76/files, but it seems like a dirty way to do it, we should only send the noop in the handle_get_request if we are currently upgrading and we sent the PONG |
@salimaboubacar given that you were able to reproduce this issue with the JS client, can I ask you to test the master branch of this repo? The fix is similar to your PR, but it goes a bit further and fully replaces the packet backlog, which was introduced a while ago to address this problem but was only partially successful. Thanks! |
Hello!
I found a confusing issue
As I understand from https://github.com/socketio/engine.io-protocol/blob/master/README.md, when the client sends the
PING
packet, server should respond with thePONG
packet and then the client sends theUPGRADE
packet.BUT! In some random cases (found only on the iOS browsers)
NOOP
packet which should be sent afterPONG
is processed beforePONG
and client hangs by 25s without sending upgrade packet.I found that this issue appears since v3.2.0 release of python-engineio
If I revert these changes 919d8ea#diff-73af4c5d72e7a60feddc2ce0427079d3R90-R93 to
just
self.queue.put(pkt)
without packet_backlog, the problem doesn't appear.I really couldn't figure out what was causing the problem, how putting messages to the packet_backlog instead of the queue could cause a change in the order of processing low-level packets in the client.
It's reproducible with the simple Flask-SocketIO example (async_mode is eventlet with monkey patching)
Debug log from the iOS browser (tested with Safari 13 and Chrome 79.0.3945.73)
The text was updated successfully, but these errors were encountered: