-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Starscream hangs when NSStream closes due to connectivity issues #164
Comments
I noticed this when debugging #158 |
I just checked in a fix into master. Let me know if that seems to resolve it and I will do another release. |
Unfortunately, the change does not fix it. The change now actually introduces a deadlock and it ends up still hanging in the same place. The reason is, on timeout Do you need to call The bug is easily reproducible by simply having Starscream connect to a non-running WebSocket server. |
Ah, good point totally overlooked that. You are correct the delegate will call it, I also overlooked that. I check in another fix that I believe should handle it now. Thank you for the feedback. |
Had the same issue and lost quite a bit of time debugging. Works fine after applying your latest fixes. Cheers! |
|
I was testing the case when my websocket server is down, and noticed that Starscream hangs when it receives the
NSStreamEvent.ErrorOccurred
code after initialization ininitStreamsWithData
.Specifically, it hangs on the following line in
disconnectStream()
:I tracked it down, and it seems that it's due to the following operation:
Essentially, there's an infinite loop in the while loop waiting for the stream to be available, as
outStream.hasSpaceAvailable
is never true. This causes a deadlock in the disconnect waiting forwriteQueue
to be empty. I was able to resolve it as follows:Is this the right fix? If so, I can open a pull request with the fix.
The text was updated successfully, but these errors were encountered: