Closed normtronics closed 1 year ago
Hello @normtronics, thank you for reaching out.
I have checked with the https://github.com/launchdarkly/react-native-client-sdk/tree/main/ManualTestApp in the repo, and I was not able to reproduce the crash (I can still launch the app, and the test app can still get flag values from LaunchDarkly).
Would you be able to share your application code, and if possible, the mobile key with us so we can help debug the issue? I recommend you submit a support request (see the links in your issue description) as you do not want to share the mobile key publicly here.
@louis-launchdarkly Thanks for getting back to me. I'll file a support request as I can't share code here. The crash usually happens in the middle of me using the app for a bit. It doesn't stop the app from launching or getting the flags
Same here after upgrade to version 6.2.0 Exception is thrown here:
@objc func unregisterFeatureFlagListener(_ flagKey: String, environment: String) {
let multiListenerId = envConcat(environment: environment, identifier: flagKey)
if let owner = flagListenerOwners.removeValue(forKey: multiListenerId) {
LDClient.get(environment: environment)!.stopObserving(owner: owner)
}
Error:
launchdarkly_react_native_client_sdk/LaunchdarklyReactNativeClient.swift:271: Fatal error: Unexpectedly found nil while unwrapping an Optional value
2022-09-29 02:07:16.173319-0700 golive[20515:121360] launchdarkly_react_native_client_sdk/LaunchdarklyReactNativeClient.swift:271: Fatal error: Unexpectedly found nil while unwrapping an Optional value
(lldb)
The exception I got was actually related to the feature flags not being accessible, this is due to a recent change in the launch darkly configuration, but I think it is still related to the same root cause - unsafe unwrapping of optionals on iOS. The SDK still shouldn't crash the application if a feature flag became unavailable, so this is a pretty critical issue in my option. See below:
Hey everyone, I am facing the same issue. From time to time the app crashes on log in with the same 'Unexpectedly found nil while unwrapping an Optional value...' error for flags. We were on 6.2.0, updated to teh latest at this point 6.2.4, but still the same. Does anyone have any solution or workaround for this?
I have a long running support request to deal with this. They have been looking at it for a bit, so I don't know when or if any changes to their SDK will be made. @denissb I agree, the unsafe unwrapping is not the ideal way to deal with that.
@mnikolov-qb My team ended up checking if the LD client was nil before we did anything with it. Seems to have fixed the problem for now
Hello @normtronics, thank you for the suggestion - we think that is the issue. On the Android native adapter, there are error checks when the LDClient is null (most commonly happening when the LDClient is still in initialization), but that is not in the iOS code with the force unwrap.
While the team is working on a fix, in the meantime, we recommend checking the LDClient is nil (or waiting for initialization complete) is the correct workaround for now.
We're getting this issue, even when checking ldClient.isInitialized
before checking the flags. Any updates on a fix for this?
@normtronics could you share some code? We have the same issue and it is causing our app to have a like a 1% crash rate.
We have released 6.3.1 today which adds nil guards for ldClient which should fix this.
@yusinto tried to update the package version to 6.3.1. Now receiving the following error with the same implementation as before.
Illegal callback invocation from native module. This callback type only permits a single invocation from native code.
When I comment out the jsonVariation it works again. So this is specific to that function.
Not sure why that is happening.
This only seems to happen when running the app on a physical device.
@ruanpotgieter95 we released 6.3.2 which should fix the illegal callback invocation error.
The original issue was fixed, so I'm closing this issue to prevent unrelated discussion of other issues. Please open a new issue for those.
Is this a support request? This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going here or by emailing support@launchdarkly.com.
Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.
Describe the bug When working on my app in the simulator, the SDK crashes my app with a Fatal error: Unexpectedly found nil while unwrapping an Optional value
To reproduce Just basic use of the app
Expected behavior The app shouldn't crash
Logs dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot CoreSimulator 802.6.1 - Device: iPhone 13 (6B1163CA-E62E-4944-924D-A3B08D2D4079) - Runtime: iOS 15.5 (19F70) - DeviceType: iPhone 13 launchdarkly_react_native_client_sdk/LaunchdarklyReactNativeClient.swift:209: Fatal error: Unexpectedly found nil while unwrapping an Optional value dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
SDK version 6.2.1
Language version, developer tools TypeScript and react
OS/platform MacOS
Additional context Add any other context about the problem here.