-
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
Crash on WebSocket.swift line 259 > FoundationStream.cleanup() #471
Comments
Are you seeing a call to FoundationStream.cleanup() on your main or other thread when this happens? Click to open the rest of your threads in fabric on that issue and see if another thread is also calling it. I get crashes like this where WSStream.cleanup() is called on both threads simultaneously. I think there is a race condition here between the threads when stream.close() takes some amount of time to execute. One temporary solution might be to nil the old stream and construct a new one when reconnecting, instead of reusing the same one? But I think what should be done to fix this is to check if the stream is already closing and, if necessary, wait for it to finish doing so before reopening the stream. @daltoniam let me know if I am interpreting this right.
|
@flagoworld It doesn't crash on main thread, but on com.vluxe.starscream.websocket |
Right, but is there a call to the same close() func on another thread at the same time the websocket thread crashed? See my stack trace. |
@flagoworld You're right! .cleanup is called from two threads. |
Facing same issue any update on how to fix ?? |
This appears to fix for me: Please review and use at your own risk. I am not familiar enough with the codebase to claim that this is the correct fix. It's more of a suggestion and educated guess. |
We get the same crash (cleanup) for a while now.
@flagoworld I believe that your fix will help for the |
Version 3.0.5 has been released. It has a fix as found in #476. |
I get these crashes time by time. Wondering what could cause this.
In file WebSocket.swift line 259 I see this:
stream.close()
Full stack trace from Crashlytics:
The text was updated successfully, but these errors were encountered: