-
Notifications
You must be signed in to change notification settings - Fork 846
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
Problem connecting to custom namespace #1033
Comments
Packets are lost if they were in |
@OneSman7 That sounds plausible. Would you be able to try out your change, and if it looks good, raise a PR? |
@nuclearace Yes. I will prepare PR. We are also using Before rebooting our server sends engine close message to all clients. But sometimes on server reconnect old I am trying to isolate the issue and want to create PR that fixes both issues. |
There is no "Engine is being released" message after "Adding engine" message :( |
Hmm I remember this leak can happen when the URLSessionDelegate (the engine in this case) isn’t cleaned up in the URLSession by calling invalidate. Which I think happens in stopPolling. |
Exactly! Thank you!
When new engine is created, old one is left without client, but not disconnected. It then receives server error, so
Since no json is received If this engine receives server error before it looses client, than client handles it (our code) and disconnects engine. |
So that guard block needs to have more logic in it to handle the case where the client is gone, I think. |
I tried to disconnect old engine explicitly when creating new one and it seems to work. This seems ok since we create new one only on connect/reconnect. What do you think?
|
I think that is a good idea. 👍 |
Great 👍 |
I think we have a racing condition here. Sometimes request to connect to custom namespace (40/nsp) is not sent.
We debugged it to the method
flushProbeWait()
inSocketEngine
.It is called on web socket connect success in
doFastUpgrade()
and on web socket connect failure inwebsocketDidDisconnect(error: Error?)
(in case we are polling which is always true on start). Inside this method we have this code:Method
flushWaitingForPostToWebSocket()
causes packets to be sent by web socket. And it fails if web socket failed to connect. In our case we lose request to connect to custom namespace and do not get connected at all.I think it will be better to move this "if" from
flushProbeWait()
directly todoFastUpgrade()
, so it will be called only on web socket connect success.The text was updated successfully, but these errors were encountered: