-
-
Notifications
You must be signed in to change notification settings - Fork 595
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
Seeming race condition for the synchronous client #634
Comments
Hey Ian, great to hear from you! This is not a new problem, but the error is indeed new. The Socket.IO connection happens in the background. When you call In the 4.x and older releases if you called You are not the first to complain about this, so I intend to improve this. The two options that I'm considering are either to delay the return from What I've been telling people as a workaround is to move your emit to the It doesn't appear that I have any open issues to track this, so I might as well use this one. Thanks! |
The |
@sigmavirus24 I have attempted to fix this by adding a I'll run some more test in the next couple of days. For now, you can test by installing this package from git. |
This problem still persist even with the upgrade. In my case, I am testing the lost of wifi connection of the Raspberry Pi4 by running |
@jsib0 my guess is that your problem is different, but in any case, if you think this is a problem then write a new issue and include detailed logs that cover the incident. |
Can you give me some example on how to move the code inside |
@leolo0626 this issue has been fixed long ago. If you have a question that applies to current code, please write it with all the context in the discussions board. |
Do you mean to say self.sio.connect(hostname, headers={"User-Agent": "python-socketio[client]/socket"},auth=auth,transports="websocket", wait_timeout=3) increasing wait_timeout can resolve this issue(badnamespace)? currently its 3 second |
@shrikantpadhy18 if you are connecting to a slow server, then yes, increasing the wait timeout may help. |
Hi there old friend,
We just upgraded from 4.6.1 to 5.0.4. Prior to the upgrade, our code was working totally fine but now occasionally crashes.
Our code first calls
connect(url, transports=["websockets"], headers={"Authorization": "FakeAuthHeader"})
which succeeds and the library's logging printsEngine.IO connection established
. Sometimes, it then promptly printsNamespace / is connected
. Other times, our code reachesemit("auth", API_KEY)
which then errors withsocketio.exceptions.BadNamespaceError: / is not a connected namespace.
but interleaved in the traceback isNamespace / is connected
. It seems like there's a race-condition in howconnect(...) -> _handle_eio_connect -> _send_packet -> _handle_connect
flows and it's not entirely synchronous.I skimmed the code but didn't immediately see the problem. Hopefully this helps.
The text was updated successfully, but these errors were encountered: