react-native-mmkv-storage: [Bug] EXC_BREAKPOINT crash after installLibrary on iOS 12.* devices
Describe the bug
Hey!
We see quite a lot of EXC_BREAKPOINT
crashes in Production, mostly coming from old iOS devices (the problem is almost unique to iPhone 6, 6 Plus and 7, according to the bug-reporting tool). And it only happens on iOS 12.*
. Works totally fine on any other type of device / OS.
Stacktrace below:
Exception Type: EXC_BREAKPOINT
EXC_BREAKPOINT:
0 AppName facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::Around::Around(facebook::react::(anonymous namespace)::ReentrancyCheck&) (HermesExecutorFactory.cpp:123:7)
1 AppName facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::createPropNameIDFromAscii(char const*, unsigned long) (decorator.h:529:12)
2 AppName install(facebook::jsi::Runtime&) (jsi.h:365:20)
3 AppName -[MMKVNative installLibrary] (MMKVNative.mm:77:5)
4 libdispatch.dylib __dispatch_client_callout
5 libdispatch.dylib __dispatch_continuation_pop$VARIANT$mp
6 libdispatch.dylib __dispatch_source_invoke$VARIANT$mp
7 libdispatch.dylib __dispatch_main_queue_callback_4CF$VARIANT$mp
8 CoreFoundation ___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
9 CoreFoundation ___CFRunLoopRun
10 CoreFoundation _CFRunLoopRunSpecific
11 Foundation -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
12 Foundation -[NSRunLoop(NSRunLoop) runUntilDate:]
To Reproduce Steps to reproduce the behavior:
- Crash happens on application start with the library installed.
Platform Information:
- OS: iOS,
12.*
- React Native Version
0.64.*
- Library Version
0.5.6
Additional context
We’re also using reanimated2, which is another JSI-library and doesn’t have the same problem. Which makes me think that something might be wrong during installLibrary
process.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (9 by maintainers)
Released v0.6.11
@abejfehr try the new fix in #195
@abejfehr I am working on a possible fix. Will update soon in #195
This started happening for me after upgrading react-native to 0.66
@haikov did the patch work?
Also happens on iOS 15.2.0 in production build. MMKV version : 0.6.6
Here is the stacktrace:
Well after some investigation, I think the error is caused because accessing the runtime from the wrong thread. However I don’t understand why it is happening only on a specific version of iOS and not other versions.
Because the error is happening inside the dispatch block, maybe we can remove it and see if that would help.
https://github.com/ammarahm-ed/react-native-mmkv-storage/blob/8bf0bc1992eb3f8c4ca696185a7873b34a6e056e/ios/MMKVNative.mm#L44
Fork the master branch and try removing the following code
replace it with following:
Then use it instead of the released version on npm.
If you have any people who can test, that would be great otherwise the only option is to either download ios 12.5 on an iphone and downgrade or release to production again to see if the error goes away/some new error comes up