davidstump / SwiftPhoenixClient

Connect your Phoenix and iOS applications through WebSockets!
MIT License
506 stars 146 forks source link

Crash in `Socket.append<T>(callback:to:)` function #238

Closed msandel6 closed 11 months ago

msandel6 commented 1 year ago

I'm seeing this crash intermittently when attempting to join a new phoenix topic:

Screenshot 2023-05-09 at 6 36 09 PM
dsrees commented 1 year ago

Could you provide the whole stack? And what version of the client are you running

msandel6 commented 1 year ago

I'm running version 5.3.0. Here's the call stack:

Screenshot 2023-05-10 at 10 13 38 AM

I did some more investigating this morning, and this crash virtually disappears when I call Channel.join() from the main thread (which I'd obviously like to avoid) vs. a background thread. Based on that I'm pretty confident it's a threading issue, but I'll keep looking into it too.

msandel6 commented 1 year ago

Converting the stateChangeCallbacks to a SynchronousArray seems to have helped, though I haven't had time to do any extensive testing or look for unwanted side effects yet. I should get around to that later today and could put up a PR with the change if it looks ok and there aren't any concerns from your side @dsrees!

msandel6 commented 1 year ago

I made a PR here. Let me know if you have any questions or concerns, or if there's any important context I'm missing.

dsrees commented 11 months ago

should be resolved in 5.3.1. Thanks for your patience, please let me know if something else pops up