realm-js: [iOS][Expo SDK 46] SIGTRAP/SIGILL crash on Release Build Configuration
Description
After upgrading to Expo SDK 46 beta-6, we started getting a fatal crash on launch on iOS Release Configuration builds with realm@11.0.0-rc.1 and hermes enabled. We managed to reproduce this crash 100% of the time on all Apple devices and simulators that we have tried, and on iOS 14/15.
Stacktrace & log output
```
Translated Report (Full Report Below)
Incident Identifier: 2CB231A5-1C1C-4F62-B740-917566BF7B41 CrashReporter Key: 958937CA-AE6A-3DEE-5690-64CE79CEB162 Hardware Model: MacBookPro18,3 Process: exporepro18317 [50036] Path: /Users/USER/Library/Developer/CoreSimulator/Devices/18E2A611-92EA-4CA2-9D5C-6EF8793B6E39/data/Containers/Bundle/Application/57D7F7C5-E9F0-40EA-82DE-ADC91BBA095C/exporepro18317.app/exporepro18317 Identifier: com.exporepro18317.exporepro18317 Version: 1.0.0 (1) Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd_sim [75757] Coalition: com.apple.CoreSimulator.SimDevice.18E2A611-92EA-4CA2-9D5C-6EF8793B6E39 [25352] Responsible Process: SimulatorTrampoline [4038]
Date/Time: 2022-07-21 23:24:28.9015 +0800 Launch Time: 2022-07-21 23:24:28.7664 +0800 OS Version: macOS 12.4 (21F79) Release Type: User Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x00000001026b75dc Exception Note: EXC_CORPSE_NOTIFY Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [50036]
Triggered by Thread: 9
Thread 0:: Dispatch queue: com.apple.main-thread 0 UIKitCore 0x1852ea448 ﹍[UIView(Animation) performWithoutAnimation:]﹍ 0 1 UIKitCore 0x184bbb668 ﹍[UIRemoteKeyboardWindow remoteKeyboardWindowForScreen:create:]﹍ 264 2 UIKitCore 0x184bc1b2c __44-[_UIRemoteKeyboards applicationWillResume:]_block_invoke + 172 3 libdispatch.dylib 0x18010ea98 _dispatch_client_callout + 16 4 libdispatch.dylib 0x180112268 _dispatch_block_invoke_direct + 244 5 FrontBoardServices 0x1861b8074 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK
- 40 6 FrontBoardServices 0x1861b7f4c -[FBSSerialQueue _targetQueue_performNextIfPossible] + 176 7 FrontBoardServices 0x1861b80a4 -[FBSSerialQueue _performNextFromRunLoopSource] + 24 8 CoreFoundation 0x180362234 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24 9 CoreFoundation 0x180362134 __CFRunLoopDoSource0 + 204 10 CoreFoundation 0x1803614c4 __CFRunLoopDoSources0 + 256 11 CoreFoundation 0x18035ba18 __CFRunLoopRun + 744 12 CoreFoundation 0x18035b218 CFRunLoopRunSpecific + 572 13 GraphicsServices 0x18c25f60c GSEventRunModal + 160 14 UIKitCore 0x184d88a98 -[UIApplication _run] + 992 15 UIKitCore 0x184d8d634 UIApplicationMain + 112 16 exporepro18317 0x1024dc2c0 main + 88 (main.m:7) 17 dyld_sim 0x103639cd8 start_sim + 20 18 dyld 0x1036d908c start + 520
Thread 1: 0 libsystem_pthread.dylib 0x1cc0ac8fc start_wqthread + 0
Thread 2:: Dispatch queue: com.facebook.react.ShadowQueue 0 libdispatch.dylib 0x18010fff8 dispatch_once + 0 1 exporepro18317 0x1025dd5f8 dispatch_once + 16 (once.h:84) [inlined] 2 exporepro18317 0x1025dd5f8 ﹍[RCTI18nUtil sharedInstance]﹍ 112 (RCTI18nUtil.m:18) 3 exporepro18317 0x1025f43f8 -[RCTRootShadowView init] + 72 (RCTRootShadowView.m:18) 4 exporepro18317 0x10260fe14 __33-[RCTUIManager registerRootView:]_block_invoke + 52 (RCTUIManager.m:326) 5 libdispatch.dylib 0x18010d244 _dispatch_call_block_and_release + 24 6 libdispatch.dylib 0x18010ea98 _dispatch_client_callout + 16 7 libdispatch.dylib 0x180115acc _dispatch_lane_serial_drain + 652 8 libdispatch.dylib 0x180116648 _dispatch_lane_invoke + 400 9 libdispatch.dylib 0x180120e10 _dispatch_workloop_worker_thread + 736 10 libsystem_pthread.dylib 0x1cc0adb40 _pthread_wqthread + 284 11 libsystem_pthread.dylib 0x1cc0ac904 start_wqthread + 8
Thread 3: 0 libsystem_pthread.dylib 0x1cc0ac8fc start_wqthread + 0
Thread 4: 0 libsystem_pthread.dylib 0x1cc0ac8fc start_wqthread + 0
Thread 5:: Dispatch queue: com.apple.root.user-interactive-qos 0 hermes 0x10402de28 0x103f54000 + 892456 1 hermes 0x103f758f4 0x103f54000 + 137460 2 hermes 0x103f5ca14 0x103f54000 + 35348 3 exporepro18317 0x1026b61c0 facebook::jsi::RuntimeDecorator<facebook::jsi::Runtime, facebook::jsi::Runtime>::call(facebook::jsi::Function const&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) + 36 (decorator.h:300) [inlined] 4 exporepro18317 0x1026b61c0 facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::call(facebook::jsi::Function const&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) + 96 (decorator.h:703) 5 exporepro18317 0x102534478 facebook::jsi::Function::callWithThis(facebook::jsi::Runtime&, facebook::jsi::Object const&, facebook::jsi::Value const*, unsigned long) const + 68 (jsi-inl.h:249) [inlined] 6 exporepro18317 0x102534478 facebook::jsi::Function::callWithThis(facebook::jsi::Runtime&, facebook::jsi::Object const&, std::initializer_listfacebook::jsi::Value) const + 68 (jsi-inl.h:256) [inlined] 7 exporepro18317 0x102534478 -[EXJavaScriptObject defineProperty:value:options:] + 480 (EXJavaScriptObject.mm:94) 8 exporepro18317 0x10253b444 ﹍[EXJavaScriptRuntimeManager installExpoModulesHostObject:]﹍ 300 (EXJSIInstaller.mm:49) 9 exporepro18317 0x102574e0c $s15ExpoModulesCore10AppContextC07installaB10HostObjectyyKF + 28 (AppContext.swift:290) [inlined] 10 exporepro18317 0x102574e0c $s15ExpoModulesCore10AppContextC7runtimeSo19EXJavaScriptRuntimeCSgvW + 32 (AppContext.swift:57) [inlined] 11 exporepro18317 0x102574e0c $s15ExpoModulesCore10AppContextC7runtimeSo19EXJavaScriptRuntimeCSgvs + 32 [inlined] 12 exporepro18317 0x102574e0c ExpoBridgeModule.javaScriptWillStartExecutingNotification(😃 + 564 (ExpoBridgeModule.swift:76) 13 exporepro18317 0x102575014 @objc ExpoBridgeModule.javaScriptWillStartExecutingNotification(😃 + 112 14 CoreFoundation 0x180332f90 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER
- 20 15 CoreFoundation 0x180332f48 ___CFXRegistrationPost_block_invoke + 48 16 CoreFoundation 0x180332358 _CFXRegistrationPost + 416 17 CoreFoundation 0x180331d48 _CFXNotificationPost + 692 18 Foundation 0x1807d9964 -[NSNotificationCenter postNotificationName:object:userInfo:] + 92 19 exporepro18317 0x1025d29c0 __51-[RCTCxxBridge executeApplicationScript:url:async:]_block_invoke + 228 (RCTCxxBridge.mm:1504) 20 exporepro18317 0x1025d7ae0 std::*1::*function::__value_func<void ()>::operator()() const + 20 (function.h:505) [inlined] 21 exporepro18317 0x1025d7ae0 std::__1::function<void ()>::operator()() const + 20 (function.h:1182) [inlined] 22 exporepro18317 0x1025d7ae0 facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 32 (RCTCxxUtils.mm:74) 23 exporepro18317 0x1025cc604 -[RCTCxxBridge _tryAndHandleError:] + 100 (RCTCxxBridge.mm:344) 24 exporepro18317 0x1025d2878 -[RCTCxxBridge executeApplicationScript:url:async:] + 164 (RCTCxxBridge.mm:1502) 25 exporepro18317 0x1025d26d4 -[RCTCxxBridge enqueueApplicationScript:url:onComplete:] + 88 (RCTCxxBridge.mm:1479) 26 exporepro18317 0x1025d0398 -[RCTCxxBridge executeSourceCode:sync:] + 240 (RCTCxxBridge.mm:1079) 27 exporepro18317 0x1025cda04 __21-[RCTCxxBridge start]_block_invoke_2 + 96 (RCTCxxBridge.mm:505) 28 libdispatch.dylib 0x18010d244 _dispatch_call_block_and_release + 24 29 libdispatch.dylib 0x18010ea98 _dispatch_client_callout + 16 30 libdispatch.dylib 0x18011f8a0 _dispatch_root_queue_drain + 732 31 libdispatch.dylib 0x1801200f4 _dispatch_worker_thread2 + 160 32 libsystem_pthread.dylib 0x1cc0adb04 _pthread_wqthread + 224 33 libsystem_pthread.dylib 0x1cc0ac904 start_wqthread + 8
Thread 6:: com.apple.uikit.eventfetch-thread 0 libsystem_kernel.dylib 0x1cc055fcc mach_msg_trap + 8 1 libsystem_kernel.dylib 0x1cc056430 mach_msg + 72 2 CoreFoundation 0x18036176c __CFRunLoopServiceMachPort + 368 3 CoreFoundation 0x18035bb78 __CFRunLoopRun + 1096 4 CoreFoundation 0x18035b218 CFRunLoopRunSpecific + 572 5 Foundation 0x180827828 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 232 6 Foundation 0x180827ae0 -[NSRunLoop(NSRunLoop) runUntilDate:] + 88 7 UIKitCore 0x184e3f01c -[UIEventFetcher threadMain] + 472 8 Foundation 0x180851578 NSThread__start
- 792 9 libsystem_pthread.dylib 0x1cc0b16c8 _pthread_start + 116 10 libsystem_pthread.dylib 0x1cc0ac910 thread_start + 8
Thread 7: 0 libsystem_pthread.dylib 0x1cc0ac8fc start_wqthread + 0
Thread 8: 0 libsystem_pthread.dylib 0x1cc0ac8fc start_wqthread + 0
Thread 9 Crashed:: com.facebook.react.JavaScript 0 exporepro18317 0x1026b75dc facebook::react::(anonymous namespace)::ReentrancyCheck::before() + 8 (HermesExecutorFactory.cpp:123) [inlined] 1 exporepro18317 0x1026b75dc facebook::jsi::detail::BeforeCaller<facebook::react::(anonymous namespace)::ReentrancyCheck, void>::before(facebook::react::(anonymous namespace)::ReentrancyCheck&) + 8 (decorator.h:418) [inlined] 2 exporepro18317 0x1026b75dc facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::Around::Around(facebook::react::(anonymous namespace)::ReentrancyCheck&) + 8 (decorator.h:743) [inlined] 3 exporepro18317 0x1026b75dc facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::Around::Around(facebook::react::(anonymous namespace)::ReentrancyCheck&) + 112 (decorator.h:742) 4 exporepro18317 0x1026b7588 std::*1::*libcpp_thread_get_current_id() + 4 (__threading_support:426) [inlined] 5 exporepro18317 0x1026b7588 std::*1::this_thread::get_id() + 4 (threading_support:715) [inlined] 6 exporepro18317 0x1026b7588 facebook::react::(anonymous namespace)::ReentrancyCheck::before() + 4 (HermesExecutorFactory.cpp:87) [inlined] 7 exporepro18317 0x1026b7588 facebook::jsi::detail::BeforeCaller<facebook::react::(anonymous namespace)::ReentrancyCheck, void>::before(facebook::react::(anonymous namespace)::ReentrancyCheck&) + 4 (decorator.h:418) [inlined] 8 exporepro18317 0x1026b7588 facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::Around::Around(facebook::react::(anonymous namespace)::ReentrancyCheck&) + 8 (decorator.h:743) [inlined] 9 exporepro18317 0x1026b7588 facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::Around::Around(facebook::react::(anonymous namespace)::ReentrancyCheck&) + 28 (decorator.h:742) 10 exporepro18317 0x1026b5400 facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::createStringFromAscii(char const, unsigned long) + 48 (decorator.h:574) 11 exporepro18317 0x10272f9e4 facebook::jsi::Value facebook::jsi::Function::call<char const (&) [11], std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> > >(facebook::jsi::Runtime&, char const (&) [11], std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >&&) const + 96 12 exporepro18317 0x102720ecc realm::js::realmjsi::ObjectWrap<realm::js::ObservableClassrealm::js::realmjsi::Types >::create_constructor(realm::js::JsiEnv) + 548 13 exporepro18317 0x10271eb70 realm::js::RealmClassrealm::js::realmjsi::Types::create_constructor(realm::js::JsiEnv) + 44 14 exporepro18317 0x10271e9ac realm_jsi_init + 184 15 exporepro18317 0x102701700 __24-[RealmReact setBridge:]_block_invoke + 408 (RealmReact.mm:156) 16 exporepro18317 0x1025d7ae0 std::*1::*function::__value_func<void ()>::operator()() const + 20 (function.h:505) [inlined] 17 exporepro18317 0x1025d7ae0 std::__1::function<void ()>::operator()() const + 20 (function.h:1182) [inlined] 18 exporepro18317 0x1025d7ae0 facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 32 (RCTCxxUtils.mm:74) 19 exporepro18317 0x1025cc604 -[RCTCxxBridge _tryAndHandleError:] + 100 (RCTCxxBridge.mm:344) 20 Foundation 0x180851928 __NSThreadPerformPerform + 164 21 CoreFoundation 0x180362234 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
- 24 22 CoreFoundation 0x180362134 __CFRunLoopDoSource0 + 204 23 CoreFoundation 0x1803614c4 __CFRunLoopDoSources0 + 256 24 CoreFoundation 0x18035ba18 __CFRunLoopRun + 744 25 CoreFoundation 0x18035b218 CFRunLoopRunSpecific + 572 26 exporepro18317 0x1025cc538 ﹍[RCTCxxBridge runRunLoop]﹍ 264 (RCTCxxBridge.mm:335) 27 Foundation 0x180851578 NSThread__start + 792 28 libsystem_pthread.dylib 0x1cc0b16c8 _pthread_start + 116 29 libsystem_pthread.dylib 0x1cc0ac910 thread_start + 8
Thread 10:: hades 0 libsystem_kernel.dylib 0x1cc059694 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x1cc0b1c88 _pthread_cond_wait + 1224 2 libc++.1.dylib 0x18026718c std::*1::condition_variable::wait(std::*1::unique_lockstd::__1::mutex&) + 24 3 hermes 0x104063934 0x103f54000 + 1112372 4 hermes 0x1040636e8 0x103f54000 + 1111784 5 libsystem_pthread.dylib 0x1cc0b16c8 _pthread_start + 116 6 libsystem_pthread.dylib 0x1cc0ac910 thread_start + 8
Thread 11:: hermes-chrome-inspector-conn 0 libsystem_kernel.dylib 0x1cc059694 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x1cc0b1c88 pthread_cond_wait + 1224 2 libc++.1.dylib 0x18026718c std::*1::condition_variable::wait(std::*1::unique_lockstd::__1::mutex&) + 24 3 exporepro18317 0x1026de204 void std::*1::condition_variable::waitfacebook::hermes::inspector::detail::SerialExecutor::runLoop()::$_1(std::*1::unique_lockstd::*1::mutex&, facebook::hermes::inspector::detail::SerialExecutor::runLoop():😒1) + 28 (*mutex_base:404) [inlined] 4 exporepro18317 0x1026de204 facebook::hermes::inspector::detail::SerialExecutor::runLoop() + 120 (SerialExecutor.cpp:41) 5 exporepro18317 0x1026a1adc decltype(static_cast<void (>(fp)(static_cast<std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >>(fp0), static_cast<std::*1::function<void ()>>(fp0))) std::*1::*invoke<void ()(std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::*1::function<void ()>), std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::1::function<void ()> >(void (&&)(std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::*1::function<void ()>), std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >&&, std::*1::function<void ()>&&) + 52 (type_traits:3918) [inlined] 6 exporepro18317 0x1026a1adc void std::*1::*thread_execute<std::*1::unique_ptr<std::*1::*thread_struct, std::1::default_deletestd::*1::*thread_struct >, void ()(std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::*1::function<void ()>), std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::*1::function<void ()>, 2ul, 3ul>(std::*1::tuple<std::*1::unique_ptr<std::*1::*thread_struct, std::1::default_deletestd::*1::*thread_struct >, void ()(std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::*1::function<void ()>), std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::*1::function<void ()> >&, std::1::__tuple_indices<2ul, 3ul>) + 56 (thread:287) [inlined] 7 exporepro18317 0x1026a1adc void std::*1::*thread_proxy<std::*1::tuple<std::*1::unique_ptr<std::*1::thread_struct, std::1::default_deletestd::*1::__thread_struct >, void ()(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<void ()> > >(void) + 116 (thread:298) 8 libsystem_pthread.dylib 0x1cc0b16c8 _pthread_start + 116 9 libsystem_pthread.dylib 0x1cc0ac910 thread_start + 8
Thread 12:: hermes-inspector 0 libsystem_kernel.dylib 0x1cc059694 __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x1cc0b1c88 pthread_cond_wait + 1224 2 libc++.1.dylib 0x18026718c std::*1::condition_variable::wait(std::*1::unique_lockstd::__1::mutex&) + 24 3 exporepro18317 0x1026de204 void std::*1::condition_variable::waitfacebook::hermes::inspector::detail::SerialExecutor::runLoop()::$_1(std::*1::unique_lockstd::*1::mutex&, facebook::hermes::inspector::detail::SerialExecutor::runLoop():😒1) + 28 (*mutex_base:404) [inlined] 4 exporepro18317 0x1026de204 facebook::hermes::inspector::detail::SerialExecutor::runLoop() + 120 (SerialExecutor.cpp:41) 5 exporepro18317 0x1026a1adc decltype(static_cast<void (>(fp)(static_cast<std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >>(fp0), static_cast<std::*1::function<void ()>>(fp0))) std::*1::*invoke<void ()(std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::*1::function<void ()>), std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::1::function<void ()> >(void (&&)(std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::*1::function<void ()>), std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >&&, std::*1::function<void ()>&&) + 52 (type_traits:3918) [inlined] 6 exporepro18317 0x1026a1adc void std::*1::*thread_execute<std::*1::unique_ptr<std::*1::*thread_struct, std::1::default_deletestd::*1::*thread_struct >, void ()(std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::*1::function<void ()>), std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::*1::function<void ()>, 2ul, 3ul>(std::*1::tuple<std::*1::unique_ptr<std::*1::*thread_struct, std::1::default_deletestd::*1::*thread_struct >, void ()(std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::*1::function<void ()>), std::*1::basic_string<char, std::*1::char_traits<char>, std::*1::allocator<char> >, std::*1::function<void ()> >&, std::1::__tuple_indices<2ul, 3ul>) + 56 (thread:287) [inlined] 7 exporepro18317 0x1026a1adc void std::*1::*thread_proxy<std::*1::tuple<std::*1::unique_ptr<std::*1::thread_struct, std::1::default_deletestd::*1::__thread_struct >, void ()(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::function<void ()> > >(void) + 116 (thread:298) 8 libsystem_pthread.dylib 0x1cc0b16c8 _pthread_start + 116 9 libsystem_pthread.dylib 0x1cc0ac910 thread_start + 8
Thread 9 crashed with ARM Thread State (64-bit): x0: 0x000000016de0f000 x1: 0x0000600003cb1d88 x2: 0x000000000000000a x3: 0x00000001cc0a2b0b x4: 0x0000000001000008 x5: 0x0000000000000030 x6: 0x0000000000000000 x7: 0x0000000107ffcccc x8: 0x000000016dbdf000 x9: 0xa3bcaf80f146c3c5 x10: 0x0000000000179f41 x11: 0x00000000000b37f0 x12: 0x0000000149600000 x13: 0x0000000000000000 x14: 0x00000000006d17d5 x15: 0x0000000000e2c6c0 x16: 0x00000001cc0ad2c8 x17: 0x000000000000e2c6 x18: 0x0000000000000000 x19: 0x000000016de0d778 x20: 0x0000600003cb1d88 x21: 0x0000600003cb1d58 x22: 0x000000016de0d7b8 x23: 0x0000000102c6dab5 x24: 0x0000600000d9ae40 x25: 0x000000014a83d048 x26: 0x000000002b3100d5 x27: 0x0000000102d80000 x28: 0x00000001da9cf000 fp: 0x000000016de0d760 lr: 0x00000001026b7588 sp: 0x000000016de0d750 pc: 0x00000001026b75dc cpsr: 0x20001000 far: 0x000000010272f984 esr: 0xf2000001 (Breakpoint) brk 1
Binary Images: 0x18417b000 - 0x18560dfff com.apple.UIKitCore (1.0) <7bbc9f13-df06-3c47-9a63-8483442bdfcb> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore 0x18010b000 - 0x18014dfff libdispatch.dylib ⭐ <a06c95dc-09e7-3a87-afb6-7e1b0bec1287> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib 0x18615d000 - 0x1861e6fff com.apple.FrontBoardServices (765.10) <bc3a0db0-7ff7-38cb-bb7d-7986d5d239ef> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices 0x1802dc000 - 0x18068bfff com.apple.CoreFoundation (6.9) <673c8a21-98bf-38f0-a038-55ab0de23142> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation 0x18c25c000 - 0x18c264fff com.apple.GraphicsServices (1.0) <9334a354-2177-30b1-b919-4fecf59fef22> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices 0x1024d8000 - 0x102ccffff com.exporepro18317.exporepro18317 (1.0.0) <ca210b1b-d549-38b1-9982-49a1a2baf6ed> /Users/USER/Library/Developer/CoreSimulator/Devices/18E2A611-92EA-4CA2-9D5C-6EF8793B6E39/data/Containers/Bundle/Application/57D7F7C5-E9F0-40EA-82DE-ADC91BBA095C/exporepro18317.app/exporepro18317 0x103638000 - 0x103673fff dyld_sim ⭐ <67298116-bb18-3438-b22e-8d2b9d4618e9> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim 0x1036d4000 - 0x103733fff dyld ⭐ <d9c2a46e-8dc4-3950-9d6a-f799e8ccb683> /usr/lib/dyld 0x1cc0aa000 - 0x1cc0b6fff libsystem_pthread.dylib ⭐ <f354eadf-ba89-3191-bbdd-9f36eda1f6ca> /usr/lib/system/libsystem_pthread.dylib 0x103f54000 - 0x1041e7fff dev.hermesengine.iphonesimulator (0.11.0) <2c03abcd-37c8-3282-9295-30ebb35366e4> /Users/USER/Library/Developer/CoreSimulator/Devices/18E2A611-92EA-4CA2-9D5C-6EF8793B6E39/data/Containers/Bundle/Application/57D7F7C5-E9F0-40EA-82DE-ADC91BBA095C/exporepro18317.app/Frameworks/hermes.framework/hermes 0x180700000 - 0x1809c3fff com.apple.Foundation (6.9) <ded71e05-af0a-3172-b09e-7f070ec7d4aa> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation 0x1cc055000 - 0x1cc08afff libsystem_kernel.dylib ⭐ <d7107c39-03e1-32e1-9488-821b52158a1e> /usr/lib/system/libsystem_kernel.dylib 0x18025b000 - 0x1802b6fff libc++.1.dylib ⭐ <03a5f91e-2bc5-3d4f-b91f-729633a08579> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++.1.dylib
EOF
### Can you reproduce a bug?
Yes, always
### Reproduction Steps
Minimal repro can be found [here](https://github.com/thespacemanatee/realm-repro-4735).
### Version
11.0.0-rc.1
### What SDK flavour are you using?
Atlas App Services (auth, functions, etc.)
### Are you using encryption?
No, not using encryption
### Platform OS and version(s)
All iOS versions
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 70 (46 by maintainers)
Commits related to this issue
- [core] fix installing expo hostobject thread issue on ios hermes (#20506) # Why Hermes is much thread sensitive, there are some crashes if we don't setup js stuffs on js thread. possible fix for ... — committed to expo/expo by Kudo 2 years ago
- [core] fix installing expo hostobject thread issue on ios hermes (#20506) Hermes is much thread sensitive, there are some crashes if we don't setup js stuffs on js thread. possible fix for https://gi... — committed to expo/expo by Kudo 2 years ago
- [core] fix installing expo hostobject thread issue on ios hermes (#20506) Hermes is much thread sensitive, there are some crashes if we don't setup js stuffs on js thread. possible fix for https://gi... — committed to expo/expo by Kudo 2 years ago
@Kudo It works! Thanks so much for helping everyone out with this.
Anyone needed this now, can use
patch-packageto apply this change. Until then, we are excited for the next release so we can finally close this ticket.that’s a great example, thanks @takameyer. i found another code path to access js in non-js thread. the updated pr should do the trick: https://github.com/expo/expo/pull/20506/files
Thanks for your help @Kudo! I’ll close this issue now that we have a fix released for everyone 🙂
The culprit is here: https://github.com/facebook/react-native/blob/46ffeca3b00cfab1c6d27fd1e754b02406cf288c/ReactCommon/hermes/executor/HermesExecutorFactory.cpp#L109
It would appear there is a conflict between how Expo and Realm cross the bridge. This assertion is only active in Release mode. We will continue to investigate for a fix, either on our side or Expo’s side.
@takameyer We’re having problems not with Realm and Expo specifically, but with Expo and another JSI enabled module + Hermes, however it’s much the same, exactly as you predicted in the previous comment. Our crash logs indicate a race condition between 2 threads, the same as the above posted logs indicate. This thread has been pretty useful in debugging the issue, so I figured I’d share what we’ve found so far to help as well.
Expo triggers its JSI modules host installation based on a notification observer. The notification is explicitly set to be dispatch on the main queue to avoid problems with RCTRootView, which effectively shows the problem also seen above.
The last part so far seems to me to be that since the re-entrancy check stores the first thread ID atomically in the shared runtime that both threads are accessing, this problem occurs. We have logs of both VisionCamera failing with this exception from interacting with the shared JSI runtime at the “wrong” time and vice versa.
Since we also have Expo crash logs, I’ll probably be opening an issue ticket over there and refer to this as well.
EDIT: Pointed to the wrong VisionCamera line, corrected from L104 to L167
thanks @takameyer for kind confirmation and everyone pays attention to this issue. sorry that we cause the issue for such a while. we will work on publishing a new release early this week.
@carbopilot Thanks for the detailed reproduction steps. We will investigate this as soon as we can.
hi there! we’ve published
expo@47.0.9orexpo@46.0.19with the fix. hopefully that would resolve everyone’s issue. if there are still problems, please let me know. thanks!hi, this is kudo from expo. thanks everyone for providing great investigation and insight in this thread. i try reproducing the issue with the original example and can confirm the crash. https://github.com/expo/expo/pull/20506 is the candidate fix. if someone can patch the fix locally and help to confirm whether this is the root cause. that’s 100% appreciated.
@DaBs Thanks for sharing your findings! I will also be reaching out to Expo directly about this issue. It’s possible the new architecture could help alleviate this, but we have a lot of heavy lifting to do before we are ready to make that shift.
@mk04366 Interesting that you are getting this exact issue in a non-expo. I can imagine that if we are having this issue with Expo Modules, that we could potentially also run into this in conjunction with other libraries that are using JSI to bind their native C++ modules.
I will start digging into any potential ways that we could improve how we bind Realm to the JavaScript runtime.
@ElicaInc The stacktrace you are posting is unrelated to this issue. It does appear to be an issue from the usage of Realm itself. If you could post more details in a new issue, with some code samples in where/how this is occurring, then we can plan on investigating this further.
Hi @takameyer. Thanks - This has wasted so much time over the last few months, evidently for a lot of developers.
I’ve added some further info which consistently replicates the issue, on both M1 and Intel Macs, across every device / simulator we test with.
To summarise - It’s still not working in iOS with Hermes and Expo in release mode.
Steps to reproduce:
So …
Versions as per a clean install: “expo”: “^47.0.0”, “react”: “18.1.0”, “react-native”: “0.70.6”, “realm”: “^11.3.0”
Exception details:
Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Termination Reason: SIGNAL 4 Illegal instruction: 4 Terminating Process: exc handler [11938]
Triggered by Thread: 6 Thread 6 Crashed:: Dispatch queue: com.apple.root.user-interactive-qos 0 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x10349219f facebook::react::(anonymous namespace)::ReentrancyCheck::before() + 10 (HermesExecutorFactory.cpp:123) [inlined] 1 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x10349219f facebook::jsi::detail::BeforeCaller<facebook::react::(anonymous namespace)::ReentrancyCheck, void>::before(facebook::react::(anonymous namespace)::ReentrancyCheck&) + 10 (decorator.h:424) [inlined] 2 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x10349219f facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::Around::Around(facebook::react::(anonymous namespace)::ReentrancyCheck&) + 10 (decorator.h:749) [inlined] 3 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x10349219f facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::Around::Around(facebook::react::(anonymous namespace)::ReentrancyCheck&) + 83 (decorator.h:748) 4 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x103490674 facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::createObject() + 30 (decorator.h:593) 5 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1032f9f38 facebook::jsi::Object::Object(facebook::jsi::Runtime&) + 16 (jsi.h:570) [inlined] 6 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1032f9f38 std::__1::__shared_ptr_emplace<facebook::jsi::Object, std::__1::allocatorfacebook::jsi::Object >::__shared_ptr_emplacefacebook::jsi::Runtime&(std::__1::allocatorfacebook::jsi::Object, facebook::jsi::Runtime&) + 37 (shared_ptr.h:298) [inlined] 7 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1032f9f38 std::__1::__shared_ptr_emplace<facebook::jsi::Object, std::__1::allocatorfacebook::jsi::Object >::__shared_ptr_emplacefacebook::jsi::Runtime&(std::__1::allocatorfacebook::jsi::Object, facebook::jsi::Runtime&) + 37 (shared_ptr.h:292) [inlined] 8 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1032f9f38 std::__1::shared_ptrfacebook::jsi::Object std::__1::allocate_shared<facebook::jsi::Object, std::__1::allocatorfacebook::jsi::Object, facebook::jsi::Runtime&, void>(std::__1::allocatorfacebook::jsi::Object const&, facebook::jsi::Runtime&) + 50 (shared_ptr.h:1106) [inlined] 9 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1032f9f38 std::__1::shared_ptrfacebook::jsi::Object std::__1::make_shared<facebook::jsi::Object, facebook::jsi::Runtime&, void>(facebook::jsi::Runtime&) + 50 (shared_ptr.h:1115) [inlined] 10 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1032f9f38 -[EXJavaScriptRuntime createObject] + 72 (EXJavaScriptRuntime.Mark M 11 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1032fb39b -[EXJavaScriptRuntime initializeMainObject] + 48 (EXJavaScriptRuntime.Mark Mc 12 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1032f9ea2 -[EXJavaScriptRuntime initWithRuntime:callInvoker:] + 207 (EXJavaScriptRuntime.Mark M 13 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1032ffa44 +[EXJavaScriptRuntimeManager runtimeFromBridge:] + 148 (EXJSIInstaller.Mark M 14 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x10334665b ExpoBridgeModule.javaScriptWillStartExecutingNotification(😃 + 379 (ExpoBridgeModule.swift:76) 15 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x10334696e @objc ExpoBridgeModule.javaScriptWillStartExecutingNotification(😃 + 110 16 CoreFoundation 0x7ff80035869b CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 137 17 CoreFoundation 0x7ff8003585d1 ___CFXRegistrationPost_block_invoke + 86 18 CoreFoundation 0x7ff800357bb0 _CFXRegistrationPost + 541 19 CoreFoundation 0x7ff8003574b9 _CFXNotificationPost + 822 20 Foundation 0x7ff800c08501 -[NSNotificationCenter postNotificationName:object:userInfo:] + 82 21 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1033a94ff __51-[RCTCxxBridge executeApplicationScript:url:async:]_block_invoke + 209 (RCTCxxBridge.Mark McC 22 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1033adcfb std::__1::__function::__value_func<void ()>::operator()() const + 18 (function.h:505) [inlined] 23 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1033adcfb std::__1::function<void ()>::operator()() const + 18 (function.h:1182) [inlined] 24 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1033adcfb facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 22 (RCTCxxUtils.Mark M 25 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1033a2dc8 -[RCTCxxBridge _tryAndHandleError:] + 103 (RCTCxxBridge.Mark Mc 26 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1033a93da -[RCTCxxBridge executeApplicationScript:url:async:] + 152 (RCTCxxBridge.Mark McC 27 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1033a9274 -[RCTCxxBridge enqueueApplicationScript:url:onComplete:] + 78 (RCTCxxBridge.Mark McC 28 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1033a6f3a -[RCTCxxBridge executeSourceCode:sync:] + 215 (RCTCxxBridge.Mark McC 29 FailsReleaseModeOnIOSWithHermesExpoAndRealm 0x1033a430b __21-[RCTCxxBridge start]_block_invoke_2 + 87 (RCTCxxBridge.Mark Mc 30 libdispatch.dylib 0x7ff80013b7fb _dispatch_call_block_and_release + 12 31 libdispatch.dylib 0x7ff80013ca3a _dispatch_client_callout + 8 32 libdispatch.dylib 0x7ff800150020 _dispatch_root_queue_drain + 967 33 libdispatch.dylib 0x7ff800150928 _dispatch_worker_thread2 + 251 34 libsystem_pthread.dylib 0x7ff834c3bc9d _pthread_wqthread + 256 35 libsystem_pthread.dylib 0x7ff834c3ac67 start_wqthread + 15 Cabe:505)abe:1079)abe:1479)abe:1502)Cabe:344)cCabe:74)abe:1504)cCabe:33)cCabe:60)Cabe:193)cCabe:77)
@thespacemanatee I realize this thread has been open for too long and I am finally able to have the bandwidth to give it my full attention. I apologize for not being able to get to this sooner. My assumption could be wrong as to what your issues with our release candidate and Expo 46 were, I am just trying to rule out the usual suspects when it comes to such issues.
What I can say in full confidence is that we are currently compatible with the most updated version of Expo when using the most updated version of Realm, with or without
hermesenabled. If you have found out otherwise, then I would reopen this and investigate further.@takameyer why don’t we do away with the templated answers and lets at least acknowledge the issue? You keep asking us to refer to the matrix but I’ve been following this issue for 4 months now and you have to do better than that, especially for a product with a paid subscription model!
@eriwow Non-expo would be a different issue then. Please create a new issue and provide as many details as possible.
Legends! Thanks!
Hi @takameyer @kneth , I too am facing this similar error mentioned in 5172. I shared the error logs here if they’ll help in debugging the issue.
@carbopilot thanks for corroborating my reports. I am still getting the exact same error @takameyer
@thespacemanatee Ah thanks, perhaps it is related to the M1, I have an Intel Mac here but do have access to an M1 so will see if I can build it there