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

Crash in iOS 4.4.1 SDK #218

Closed Ruffianevan closed 3 years ago

Ruffianevan commented 4 years ago

Describe the bug We meet a crash when we are using iOS 4.4.1 SDK In our app, we call the startWithConfig function when app kill relaunch or user login successfully and try to get the flag (boolVariationForKey) at the same time. It seems the crash reason is we try to get the flag value when sdk is not inited finished, but we cannot reproduce this issue. We do not have more information for this. Below is the crash stack:

0 LaunchDarkly 0x0000000112ddafc8 static LaunchDarkly.Event.summaryEvent(flagRequestTracker: LaunchDarkly.FlagRequestTracker, endDate: Foundation.Date) -> LaunchDarkly.Event? 1 LaunchDarkly 0x0000000112e10880 LaunchDarkly.EventReporter.recordSummaryEvent(completion: () -> ()?) -> () 2 LaunchDarkly 0x0000000112e1c27c LaunchDarkly.LDClient.identify(user: LaunchDarkly.LDUser, completion: () -> ()?) -> () 3 LaunchDarkly 0x0000000112e1d010 LaunchDarkly.LDClient.start(config: LaunchDarkly.LDConfig, user: LaunchDarkly.LDUser?, completion: () -> ()?) -> () 4 LaunchDarkly 0x0000000112db2430 function signature specialization <Arg[2] = Dead> of LaunchDarkly.ObjcLDClient.start(config: LaunchDarkly.ObjcLDConfig, user: LaunchDarkly.ObjcLDUser?) -> () 5 LaunchDarkly 0x0000000112dae8a8 @objc LaunchDarkly.ObjcLDClient.start(config: LaunchDarkly.ObjcLDConfig, user: LaunchDarkly.ObjcLDUser?) -> () 6 Glip 0x0000000108cb79c4 -[GlipLaunchdarklyPlugIn start:config:callback:] 7 Glip 0x0000000108c94b6c djinni_generated::ILaunchdarkly::ObjcProxy::start(pal::UserInfo const&, pal::ConfigWrapper const&, std::1::shared_ptr const&) 8 Glip 0x00000001087912f8 std::1::function::func<glip_mobile::FeatureFlagManager::init()::$_2, std::1::allocator<glip_mobile::FeatureFlagManager::init()::$_2>, void (std::1::shared_ptr const&)>::operator()(std::1::shared_ptr const&) 9 Glip 0x0000000108c732b4 glip_mobile::AsyncTask::execute() 10 Glip 0x0000000108c8ee98 -[GlipITask execute] 11 Glip 0x0000000108c9842c 34-[GlipIOSThreadPool addOperation:]_block_invoke

SDK version iOS 4.4.1

gwhelanLD commented 4 years ago

Hi @Ruffianevan,

Thanks for filing an issue. Given your description of the issue, I think it's possible you may have run into a synchronization issue we discovered during internal review, and believed may cause an issue similar to what you have described. Unfortunately, we were also unable to replicate direct failure conditions for this locally, but we rewrote the section to avoid the issue.

This change was introduced in version 4.6.0 and the most recent 4.x release is version 4.7.0. Would you please give one of those versions a try, and update us on whether your issue is resolved? We would be very happy to get confirmation of that fix as we were unable to verify it during the development.

If you still run into issues, please let us know some additional details, such as the iOS version, whether you are calling start with a callback, and how you begin evaluating flags after calling start so we can investigate further.

Thanks! @gwhelanLD

torchhound commented 3 years ago

Hi @Ruffianevan, we haven't heard back from you in a while so I'm going to close this issue. If the solution Gavin provided didn't work or if you have further questions please ask us here or reach out to support.