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

Python Socket.io client halts with message “Received unexpected packet of type 1” #100

Closed
iwctwbai opened this issue Mar 13, 2019 · 15 comments
Assignees
Labels

Comments

@iwctwbai
Copy link

my question is like this link, i don't know why,thanks

https://stackoverflow.com/questions/55099340/python-socket-io-client-halts-with-message-received-unexpected-packet-of-type-1

Thanks for answers

@miguelgrinberg
Copy link
Owner

Can you provide context? What code are you using, what error(s) do you get?

@iwctwbai
Copy link
Author

My code is almost the same as the Stackoverflow link.
Error message only "Received unexpected packet of type 1" and socket.io (client) is disconnected.
Strangely, no callback was received when the connection was disconnected.
At this point, the program is running normally, but socket. IO is disconnected.
Thanks for answers!

@miguelgrinberg
Copy link
Owner

Please provide the code, and the complete output of the script, including the error and the stack trace.

@iwctwbai
Copy link
Author

It's not easy to provide because it's commercial code.
The mistake happened accidentally.
Today I have not been able to reproduce the problem.
Under what circumstances will such an error (“Received unexpected packet of type 1”) be made?
Can higher CPU usage lead to problems?

@miguelgrinberg
Copy link
Owner

I don't know. Never seen it before you pointed me to this question. I need some code to reproduce the problem to know more.

@iwctwbai
Copy link
Author

if I could reproduce the problem, I will contact you. thanks

@antrikshdua
Copy link

i have revived the same problem

@szero
Copy link

szero commented Mar 29, 2019

Just a hint towards possible issue. According to engine.io protocol, the CLOSE packet is expressed as 1, which isn't handled in Client.py's _receive_packet method. In the code from SO from @iwctwbai , the emit event is issued without any de-bouncing. My guess would be that if you send packets to engine.IO server with full CPU speed, it triggers some sort of anti-flood measure and the server disconnects you.

@miguelgrinberg miguelgrinberg self-assigned this Mar 30, 2019
@miguelgrinberg
Copy link
Owner

miguelgrinberg commented Mar 30, 2019

@szero thanks, I think I understand the problem now, which is actually simpler than I thought. I just did not implement the CLOSE packet for the client, it is an unintentional omission on my part. I will add this to the client.

@aaronjswank
Copy link

aaronjswank commented Apr 11, 2019

Uncertain if related, but in addition to the "unexpected packet of type 1", I also see unexpected packet of type 5, 56 or 35 and then on next message get a raise JSONDecodeError("Expecting value", s, err.value) from None. Sometimes works just fine, and sometimes get the error when testing the exact same message. (using the python socketio async client)

@miguelgrinberg
Copy link
Owner

@aaronjswank what server are you using?

@aaronjswank
Copy link

I am using flask_socketio with eventlet as main server

@miguelgrinberg
Copy link
Owner

@aaronjswank it's a different issue that I wasn't aware of. Easy to reproduce? Maybe you can share some code so that I can see the issue here?

@aaronjswank
Copy link

It's easy to reproduce. Let me see if I can trim the code down to something easy to share.

@aaronjswank
Copy link

Here is a quick extraction of code. Simple one word messages rarely cause issues. Multiple word sentences sometimes generate "received unexpected packet of type" errors.

https://github.com/aaronjswank/flask-socketio-python-client

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