launchdarkly / ios-client-sdk

LaunchDarkly Client-side SDK for iOS (Swift and Obj-C)
https://docs.launchdarkly.com/sdk/client-side/ios
Other
69 stars 84 forks source link

LDEventSource mutable array bug #222

Closed RangerRick closed 3 years ago

RangerRick commented 3 years ago

Describe the bug This is actually for the ios-eventsource project but you don't have issue-tracking enabled there so I wanted to make sure there was an issue for my PR.

If you attempt to remove listeners while events are being processed, you can get an NSArray "mutated while being enumerated" error.

To reproduce call LDEventSource.removeListener() while messages are being processed.

Expected behavior No crash.

Logs I have rebuilt since then so I don't have logs, sorry. If you need them to close this, let me know and I'll try reproducing it.

Fix I've had the code from my PR running for a couple hours now and haven't seen the crash, so I think this handles it.

gwhelanLD commented 3 years ago

Thanks again for the PR, I've merged it in ios-eventsource. I've also enabled issues on the repository. I'll close this issue now, as the SDK should not be effected.