realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.69k stars 564 forks source link

[IOS] crash on app startup in release mode with latest react native 0.70.6 #5166

Closed qusaieilouti99 closed 1 year ago

qusaieilouti99 commented 1 year ago

How frequently does the bug occur?

All the time

Description

It started when I upgraded my app from 0.68 to 0.70.6 so I enabled Hermes and updated expo to 47 and realm to 11.3.0 but kept the new arch disabled. everything worked fine in android, even on IOS debug mode, but when I switch to IOS release mode it's crashing all the time.

I tried the latest realm release 11.3.1 pushed before hours but the issue is still here. I'm sure that the issue is related to the realm because once I removed the realm it worked again without the crash.

package.json:

"dependencies": {
    "@react-native-async-storage/async-storage": "1.17.10",
    "@react-native-clipboard/clipboard": "1.11.0",
    "@react-native-community/cameraroll": "4.1.2",
    "@react-native-community/cli-platform-android": "8.0.4",
    "@react-native-community/netinfo": "8.3.1",
    "@react-native-community/push-notification-ios": "1.10.1",
    "@react-native-firebase/app": "15.4.0",
    "@react-native-firebase/crashlytics": "15.4.0",
    "@react-native-firebase/messaging": "15.4.0",
    "@react-navigation/native": "6.0.12",
    "@react-navigation/native-stack": "6.8.0",
    "@react-navigation/stack": "6.0.11",
    "@twotalltotems/react-native-otp-input": "1.3.11",
    "apisauce": "2.0.0",
    "crypto-js": "4.1.1",
    "dayjs": "1.11.5",
    "deprecated-react-native-prop-types": "2.3.0",
    "expo": "47.0.8",
    "expo-av": "13.0.1",
    "expo-file-system": "15.1.1",
    "expo-linear-gradient": "12.0.1",
    "expo-local-authentication": "13.0.2",
    "expo-localization": "14.0.0",
    "expo-modules-core": "1.0.3",
    "form-data": "4.0.0",
    "guid-typescript": "1.0.9",
    "i18n-js": "3.8.0",
    "ignite-cli": "7.15.0",
    "jwt-decode": "3.1.2",
    "lottie-ios": "3.2.3",
    "lottie-react-native": "5.1.3",
    "mobx": "6.1.8",
    "mobx-react-lite": "3.2.0",
    "mobx-state-tree": "5.0.1",
    "next-frame": "0.2.3",
    "node-forge": "^1.3.1",
    "react": "18.1.0",
    "react-hook-form": "7.35.0",
    "react-native": "0.70.6",
    "react-native-aes-crypto": "2.1.0",
    "react-native-animatable": "1.3.3",
    "react-native-background-timer": "2.4.1",
    "react-native-callkeep": "4.3.3",
    "react-native-compressor": "1.5.2",
    "react-native-config": "1.4.11",
    "react-native-contacts": "7.0.4",
    "react-native-create-thumbnail": "1.6.3",
    "react-native-date-picker": "4.2.5",
    "react-native-device-country": "1.0.2",
    "react-native-device-info": "10.1.1",
    "react-native-dialog": "9.2.2",
    "react-native-document-picker": "8.1.1",
    "react-native-fast-image": "8.5.11",
    "react-native-file-viewer": "2.1.5",
    "react-native-fs": "2.20.0",
    "react-native-gesture-handler": "2.8.0",
    "react-native-get-location": "2.2.1",
    "react-native-get-random-values": "1.8.0",
    "react-native-gif-search": "1.3.2",
    "react-native-google-places-autocomplete": "2.4.1",
    "react-native-haptic-feedback": "1.14.0",
    "react-native-hyperlink": "0.0.22",
    "react-native-image-crop-picker": "0.38.0",
    "react-native-image-pan-zoom": "2.1.12",
    "react-native-image-picker": "4.10.0",
    "react-native-in-app-review": "4.1.1",
    "react-native-incall-manager": "4.0.0",
    "react-native-maps": "0.30.2",
    "react-native-material-menu": "2.0.0",
    "react-native-media-controls": "2.3.0",
    "react-native-mime-types": "2.3.0",
    "react-native-otp-textinput": "0.0.8",
    "react-native-otp-verify": "1.0.5",
    "react-native-permissions": "3.6.1",
    "react-native-phone-number-input": "2.1.0",
    "react-native-photo-editor": "1.0.13",
    "react-native-progress": "5.0.0",
    "react-native-push-notification": "8.1.1",
    "react-native-rate": "1.2.9",
    "react-native-raw-bottom-sheet": "2.2.0",
    "react-native-reanimated": "2.13.0",
    "react-native-rename": "2.9.0",
    "react-native-restart": "0.0.24",
    "react-native-rsa-native": "2.0.5",
    "react-native-safe-area-context": "3.1.8",
    "react-native-screens": "3.8.0",
    "react-native-share": "7.9.0",
    "react-native-share-menu": "6.0.0",
    "react-native-simple-toast": "1.1.4",
    "react-native-slider": "0.11.0",
    "react-native-sms": "1.11.0",
    "react-native-splash-screen": "3.2.0",
    "react-native-status-bar-height": "2.6.0",
    "react-native-tab-view": "3.1.1",
    "react-native-uuid": "2.0.1",
    "react-native-vector-icons": "9.2.0",
    "react-native-version-check": "3.4.3",
    "react-native-video": "6.0.0-alpha.3",
    "react-native-voip-push-notification": "3.3.0",
    "react-native-webrtc": "106.0.0-beta.7",
    "reactotron-mst": "3.1.4",
    "reactotron-react-js": "3.3.8",
    "reactotron-react-native": "5.0.1",
    "realm": "11.3.0",
    "rn-fetch-blob": "0.12.0",
    "socket.io-client": "4.5.2",
    "use-debounce": "8.0.4",
    "validate.js": "0.13.1"
  },

Stacktrace & log output

{code:shell} Incident Identifier: 6BF7C7DF-E87D-4AAD-9C7E-33F812B7932B Hardware Model: iPhone10,5 Process: PingMe [382] Path: /private/var/containers/Bundle/Application/B873D3D3-4264-4EE8-9357-7F83B5652C03/PingMe.app/PingMe Identifier: com.pingme2022 Version: 1.5.2 (2) AppStoreTools: 14B44 AppVariant: 1:iPhone10,5:16 Beta: YES Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Coalition: com.pingme2022 [491]

Date/Time: 2022-12-05 18:52:08.0627 +0300 Launch Time: 2022-12-05 18:52:07.6890 +0300 OS Version: iPhone OS 16.1 (20B82) Release Type: User Baseband Version: 5.03.01 Report Version: 104

Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x0000000104f2df94 Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [382]

Triggered by Thread: 7

Thread 0 name: Thread 0: 0 libsystem_kernel.dylib 0x00000001e4086194 mach_msg2_trap + 8 (:-1) 1 libsystem_kernel.dylib 0x00000001e4097a08 mach_msg2_internal + 76 (mach_msg.c:201) 2 libsystem_kernel.dylib 0x00000001e4097c44 mach_msg_overwrite + 384 (mach_msg.c:0) 3 libsystem_kernel.dylib 0x00000001e4086688 mach_msg + 20 (mach_msg.c:323) 4 CoreFoundation 0x00000001a66f7fc4 CFRunLoopServiceMachPort + 156 (CFRunLoop.c:2622) 5 CoreFoundation 0x00000001a66f9174 CFRunLoopRun + 1232 (CFRunLoop.c:3005) 6 CoreFoundation 0x00000001a66fdb7c CFRunLoopRunSpecific + 584 (CFRunLoop.c:3418) 7 GraphicsServices 0x00000001e0a89984 GSEventRunModal + 160 (GSEvent.c:2196) 8 UIKitCore 0x00000001ad96b3c8 -[UIApplication _run] + 868 (UIApplication.m:3745) 9 UIKitCore 0x00000001ad96b040 UIApplicationMain + 312 (UIApplication.m:5335) 10 PingMe 0x0000000104c1b69c main + 80 (main.m:7) 11 dyld 0x00000001c8118df0 start + 2096 (dyldMain.cpp:1170)

Thread 1: 0 libsystem_pthread.dylib 0x00000001f2e2e674 start_wqthread + 0 (:-1)

Thread 2 name: Thread 2: 0 libsystem_kernel.dylib 0x00000001e4086194 mach_msg2_trap + 8 (:-1) 1 libsystem_kernel.dylib 0x00000001e4097a08 mach_msg2_internal + 76 (mach_msg.c:201) 2 libsystem_kernel.dylib 0x00000001e4097c44 mach_msg_overwrite + 384 (mach_msg.c:0) 3 libsystem_kernel.dylib 0x00000001e4086688 mach_msg + 20 (mach_msg.c:323) 4 libdispatch.dylib 0x00000001b2384468 _dispatch_mach_send_and_wait_for_reply + 524 (mach.c:816) 5 libdispatch.dylib 0x00000001b23847ec dispatch_mach_send_with_result_and_wait_for_reply$VARIANT$armv81 + 56 (mach.c:2017) 6 libxpc.dylib 0x00000001f2e8301c xpc_connection_send_message_with_reply_sync + 236 (connection.c:998) 7 Security 0x00000001b2bbd128 securityd_message_with_reply_sync + 120 (client.c:696) 8 Security 0x00000001b2bc6bb0 securityd_send_sync_and_do + 80 (client.c:795) 9 Security 0x00000001b2bb7680 __SecItemCopyMatching_block_invoke_2 + 272 (SecItem.m:1624) 10 Security 0x00000001b2bba59c SecItemAuthDoQuery_block_invoke + 516 (SecItem.m:1598) 11 Security 0x00000001b2bb9154 SecItemAuthDoQuery + 1140 (SecItem.m:1386) 12 Security 0x00000001b2bba280 SecItemCopyMatching_block_invoke + 104 (SecItem.m:1959) 13 Security 0x00000001b2bbfee8 SecOSStatusWith + 48 (SecItem.m:331) 14 Security 0x00000001b2bba170 SecItemCopyMatching + 364 (SecItem.m:1958) 15 PingMe 0x00000001055c3450 ﹍[APMKeychainWrapper isMigrationNeededForIdentifier:withAppID:]﹍ 320 16 PingMe 0x00000001055c3020 ﹍[APMKeychainWrapper migrateKeychainDataToStringWithIdentifier:withAppID:]﹍ 100 17 libdispatch.dylib 0x00000001b23b27c8 _dispatch_client_callout + 16 (object.m:560) 18 libdispatch.dylib 0x00000001b2382f40 _dispatch_once_callout + 28 (once.c:52) 19 PingMe 0x00000001055c2f5c ﹍[APMKeychainWrapper keychainValueWithIdentifier:appID:]﹍ 320 20 PingMe 0x00000001055c71bc -[APMMeasurement reportFirstOpenOnWorkerQueue] + 260 21 PingMe 0x00000001055c65d8 47-[APMMeasurement startMeasurementOnWorkerQueue]_block_invoke.703 + 628 22 PingMe 0x00000001055c5d78 -[APMMeasurement startMeasurementOnWorkerQueue] + 240 23 PingMe 0x00000001055c5364 -[APMMeasurement setEnabledOnWorkerQueue:] + 272 24 PingMe 0x00000001055c5244 29-[APMMeasurement setEnabled:]_block_invoke + 44 25 PingMe 0x000000010561d134 __51-[APMScheduler scheduleOnWorkerQueueBlockID:block:]_block_invoke + 44 26 libdispatch.dylib 0x00000001b23b1850 _dispatch_call_block_and_release + 24 (init.c:1518) 27 libdispatch.dylib 0x00000001b23b27c8 _dispatch_client_callout + 16 (object.m:560) 28 libdispatch.dylib 0x00000001b238d854 _dispatch_lane_serial_drain$VARIANT$armv81 + 604 (inline_internal.h:2632) 29 libdispatch.dylib 0x00000001b238e2e4 _dispatch_lane_invoke$VARIANT$armv81 + 380 (queue.c:3940) 30 libdispatch.dylib 0x00000001b2398000 _dispatch_workloop_worker_thread + 612 (queue.c:6846) 31 libsystem_pthread.dylib 0x00000001f2e2eb50 _pthread_wqthread + 284 (pthread.c:2618) 32 libsystem_pthread.dylib 0x00000001f2e2e67c start_wqthread + 8 (:-1)

Thread 3: 0 libsystem_pthread.dylib 0x00000001f2e2e674 start_wqthread + 0 (:-1)

Thread 4 name: Thread 4: 0 libsystem_kernel.dylib 0x00000001e4086194 mach_msg2_trap + 8 (:-1) 1 libsystem_kernel.dylib 0x00000001e4097a08 mach_msg2_internal + 76 (mach_msg.c:201) 2 libsystem_kernel.dylib 0x00000001e4097c44 mach_msg_overwrite + 384 (mach_msg.c:0) 3 libsystem_kernel.dylib 0x00000001e4086688 mach_msg + 20 (mach_msg.c:323) 4 CoreFoundation 0x00000001a66f7fc4 CFRunLoopServiceMachPort + 156 (CFRunLoop.c:2622) 5 CoreFoundation 0x00000001a66f9174 CFRunLoopRun + 1232 (CFRunLoop.c:3005) 6 CoreFoundation 0x00000001a66fdb7c CFRunLoopRunSpecific + 584 (CFRunLoop.c:3418) 7 Foundation 0x00000001a5a56428 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208 (NSRunLoop.m:373) 8 Foundation 0x00000001a5a56324 -[NSRunLoop(NSRunLoop) runUntilDate:] + 60 (NSRunLoop.m:420) 9 UIKitCore 0x00000001ada900e0 -[UIEventFetcher threadMain] + 424 (UIEventFetcher.m:1377) 10 Foundation 0x00000001a5a6df74 NSThreadstart__ + 704 (NSThread.m:963) 11 libsystem_pthread.dylib 0x00000001f2e30060 _pthread_start + 116 (pthread.c:893) 12 libsystem_pthread.dylib 0x00000001f2e2e688 thread_start + 8 (:-1)

Thread 5 name: Thread 5: 0 libsystem_kernel.dylib 0x00000001e4086830 stat64 + 8 1 Foundation 0x00000001a5a56f84 _NSFrameworkPathFromLibraryPath + 328 (NSBundle.m:0) 2 Foundation 0x00000001a5ebdf44 25+[NSBundle allFrameworks]_block_invoke + 240 (NSBundle.m:1300) 3 libdispatch.dylib 0x00000001b23b27c8 _dispatch_client_callout + 16 (object.m:560) 4 libdispatch.dylib 0x00000001b2382f40 _dispatch_once_callout + 28 (once.c:52) 5 Foundation 0x00000001a5ebde50 ﹍[NSBundle allFrameworks]﹍ 64 (once.h:85) 6 AccessibilityUtilities 0x00000001b42d6f60 43-[AXBinaryMonitor evaluateExistingBinaries]_block_invoke + 124 (AXBinaryMonitor.m:122) 7 libdispatch.dylib 0x00000001b23b1850 _dispatch_call_block_and_release + 24 (init.c:1518) 8 libdispatch.dylib 0x00000001b23b27c8 _dispatch_client_callout + 16 (object.m:560) 9 libdispatch.dylib 0x00000001b2389b2c _dispatch_queue_override_invoke + 708 (inline_internal.h:2632) 10 libdispatch.dylib 0x00000001b2396d48 _dispatch_root_queue_drain + 328 (inline_internal.h:0) 11 libdispatch.dylib 0x00000001b2397514 _dispatch_worker_thread2 + 160 (queue.c:7052) 12 libsystem_pthread.dylib 0x00000001f2e2eb14 _pthread_wqthread + 224 (pthread.c:2631) 13 libsystem_pthread.dylib 0x00000001f2e2e67c start_wqthread + 8 (:-1)

Thread 6 name: Thread 6: 0 CoreFoundation 0x00000001a66f9cc8 _CFRetain + 68 (CFRuntime.c:1962) 1 CoreFoundation 0x00000001a66ffd38 -[NSCFString retain] + 20 (CFObject.m:362) 2 AccessibilityUtilities 0x00000001b42f04d8 -[AXCodeLoader _accessibilityCodeItemMatchingName:type:path:] + 496 (AXCodeLoader.m:435) 3 AccessibilityUtilities 0x00000001b42f077c -[AXCodeLoader _associateAccessibilityCodeItemWithLoadedCodeItem:] + 296 (AXCodeLoader.m:452) 4 AccessibilityUtilities 0x00000001b42ee750 36-[AXCodeLoader _addTrackedCodeItem:]_block_invoke + 248 (AXCodeLoader.m:204) 5 libdispatch.dylib 0x00000001b23b1850 _dispatch_call_block_and_release + 24 (init.c:1518) 6 libdispatch.dylib 0x00000001b23b27c8 _dispatch_client_callout + 16 (object.m:560) 7 libdispatch.dylib 0x00000001b238d854 _dispatch_lane_serial_drain$VARIANT$armv81 + 604 (inline_internal.h:2632) 8 libdispatch.dylib 0x00000001b238e2e4 _dispatch_lane_invoke$VARIANT$armv81 + 380 (queue.c:3940) 9 libdispatch.dylib 0x00000001b2398000 _dispatch_workloop_worker_thread + 612 (queue.c:6846) 10 libsystem_pthread.dylib 0x00000001f2e2eb50 _pthread_wqthread + 284 (pthread.c:2618) 11 libsystem_pthread.dylib 0x00000001f2e2e67c start_wqthread + 8 (:-1)

Thread 7 name: Thread 7 Crashed: 0 PingMe 0x0000000104f2df94 facebook::react::(anonymous namespace)::ReentrancyCheck::before() + 8 (HermesExecutorFactory.cpp:123) 1 PingMe 0x0000000104f2df94 facebook::jsi::detail::BeforeCaller<facebook::react::(anonymous namespace)::ReentrancyCheck, void>::before(facebook::react::(anonymous namespace)::ReentrancyCheck&) + 8 (decorator.h:424) 2 PingMe 0x0000000104f2df94 facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::Around::Around(facebook::react::(anonymous namespace)::... + 8 (decorator.h:749) 3 PingMe 0x0000000104f2df94 facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::Around::Around(facebook::react::(anonymous namespace)::... + 132 (decorator.h:748) 4 PingMe 0x0000000104f2df2c std::1::libcpp_thread_get_current_id() + 4 (threading_support:426) 5 PingMe 0x0000000104f2df2c std::1::this_thread::get_id() + 4 (threading_support:715) 6 PingMe 0x0000000104f2df2c facebook::react::(anonymous namespace)::ReentrancyCheck::before() + 4 (HermesExecutorFactory.cpp:87) 7 PingMe 0x0000000104f2df2c facebook::jsi::detail::BeforeCaller<facebook::react::(anonymous namespace)::ReentrancyCheck, void>::before(facebook::react::(anonymous namespace)::ReentrancyCheck&) + 4 (decorator.h:424) 8 PingMe 0x0000000104f2df2c facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::Around::Around(facebook::react::(anonymous namespace)::... + 8 (decorator.h:749) 9 PingMe 0x0000000104f2df2c facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::Around::Around(facebook::react::(anonymous namespace)::... + 28 (decorator.h:748) 10 PingMe 0x0000000104f2bf0c facebook::jsi::WithRuntimeDecorator<facebook::react::(anonymous namespace)::ReentrancyCheck, facebook::jsi::Runtime, facebook::jsi::Runtime>::createObject() + 36 (decorator.h:593) 11 PingMe 0x0000000104c5ab40 facebook::jsi::Object::Object(facebook::jsi::Runtime&) + 20 (jsi.h:570) 12 PingMe 0x0000000104c5ab40 std::1::shared_ptr_emplace<facebook::jsi::Object, std::1::allocator >::shared_ptr_emplace<facebook::jsi::Runtime&>(std::1::allocator, faceboo... + 48 (shared_ptr.h:298) 13 PingMe 0x0000000104c5ab40 std::1::shared_ptr_emplace<facebook::jsi::Object, std::1::allocator >::shared_ptr_emplace<facebook::jsi::Runtime&>(std::1::allocator, faceboo... + 48 (shared_ptr.h:292) 14 PingMe 0x0000000104c5ab40 std::__1::shared_ptr std::1::allocate_shared<facebook::jsi::Object, std::1::allocator, facebook::jsi::Runtime&, void>(std::1::allocator<facebook:... + 60 (shared_ptr.h:1106) 15 PingMe 0x0000000104c5ab40 std::1::shared_ptr std::1::make_shared<facebook::jsi::Object, facebook::jsi::Runtime&, void>(facebook::jsi::Runtime&) + 60 (sharedptr.h:1115) 16 PingMe 0x0000000104c5ab40 -[EXJavaScriptRuntime createObject] + 88 (EXJavaScriptRuntime.mm:77) 17 PingMe 0x0000000104c5c0b4 -[EXJavaScriptRuntime initializeMainObject] + 40 (EXJavaScriptRuntime.mm:193) 18 PingMe 0x0000000104c5aa90 -[EXJavaScriptRuntime initWithRuntime:callInvoker:] + 224 (EXJavaScriptRuntime.mm:60) 19 PingMe 0x0000000104c60d98 ﹍[EXJavaScriptRuntimeManager runtimeFromBridge:]﹍ 164 (EXJSIInstaller.mm:33) 20 PingMe 0x0000000104ca0e4c ExpoBridgeModule.javaScriptWillStartExecutingNotification(:) + 372 (ExpoBridgeModule.swift:76) 21 PingMe 0x0000000104ca10fc @objc ExpoBridgeModule.javaScriptWillStartExecutingNotification(_:) + 112 (:0) 22 CoreFoundation 0x00000001a66b6b44 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER_ + 140 (CFNotificationCenter.c:661) 23 CoreFoundation 0x00000001a67560d0 CFXRegistrationPost_block_invoke + 84 (CFNotificationCenter.c:175) 24 CoreFoundation 0x00000001a673ab78 _CFXRegistrationPost + 404 (CFNotificationCenter.c:201) 25 CoreFoundation 0x00000001a66ca308 _CFXNotificationPost + 684 (CFNotificationCenter.c:1193) 26 Foundation 0x00000001a5a6f4ec -[NSNotificationCenter postNotificationName:object:userInfo:] + 88 (NSNotification.m:518) 27 PingMe 0x0000000104e5ddb8 51-[RCTCxxBridge executeApplicationScript:url:async:]_block_invoke + 200 (RCTCxxBridge.mm:1504) 28 PingMe 0x0000000104e62108 std::1::function::value_func<void ()>::operator()() const + 20 (function.h:505) 29 PingMe 0x0000000104e62108 std::1::function<void ()>::operator()() const + 20 (function.h:1182) 30 PingMe 0x0000000104e62108 facebook::react::tryAndReturnError(std::1::function<void ()> const&) + 32 (RCTCxxUtils.mm:74) 31 PingMe 0x0000000104e582a8 -[RCTCxxBridge _tryAndHandleError:] + 100 (RCTCxxBridge.mm:344) 32 PingMe 0x0000000104e5dc8c -[RCTCxxBridge executeApplicationScript:url:async:] + 152 (RCTCxxBridge.mm:1502) 33 PingMe 0x0000000104e5dafc -[RCTCxxBridge enqueueApplicationScript:url:onComplete:] + 80 (RCTCxxBridge.mm:1479) 34 PingMe 0x0000000104e5ba9c -[RCTCxxBridge executeSourceCode:sync:] + 204 (RCTCxxBridge.mm:1079) 35 PingMe 0x0000000104e59540 __21-[RCTCxxBridge start]_block_invoke_2 + 80 (RCTCxxBridge.mm:505) 36 libdispatch.dylib 0x00000001b23b1850 _dispatch_call_block_and_release + 24 (init.c:1518) 37 libdispatch.dylib 0x00000001b23b27c8 _dispatch_client_callout + 16 (object.m:560) 38 libdispatch.dylib 0x00000001b2396e68 _dispatch_root_queue_drain + 616 (inline_internal.h:2632) 39 libdispatch.dylib 0x00000001b2397514 _dispatch_worker_thread2 + 160 (queue.c:7052) 40 libsystem_pthread.dylib 0x00000001f2e2eb14 _pthread_wqthread + 224 (pthread.c:2631) 41 libsystem_pthread.dylib 0x00000001f2e2e67c start_wqthread + 8 (:-1)

Thread 8 name: Thread 8: 0 libsystem_kernel.dylib 0x00000001e4086194 mach_msg2_trap + 8 (:-1) 1 libsystem_kernel.dylib 0x00000001e4097a08 mach_msg2_internal + 76 (mach_msg.c:201) 2 libsystem_kernel.dylib 0x00000001e4097c44 mach_msg_overwrite + 384 (mach_msg.c:0) 3 libsystem_kernel.dylib 0x00000001e4086688 mach_msg + 20 (mach_msg.c:323) 4 CoreFoundation 0x00000001a66f7fc4 CFRunLoopServiceMachPort + 156 (CFRunLoop.c:2622) 5 CoreFoundation 0x00000001a66f9174 CFRunLoopRun + 1232 (CFRunLoop.c:3005) 6 CoreFoundation 0x00000001a66fdb7c CFRunLoopRunSpecific + 584 (CFRunLoop.c:3418) 7 PingMe 0x0000000104e581e0 ﹍[RCTCxxBridge runRunLoop]﹍ 212 (RCTCxxBridge.mm:335) 8 Foundation 0x00000001a5a6df74 NSThreadstart__ + 704 (NSThread.m:963) 9 libsystem_pthread.dylib 0x00000001f2e30060 _pthread_start + 116 (pthread.c:893) 10 libsystem_pthread.dylib 0x00000001f2e2e688 thread_start + 8 (:-1)

Thread 9 name: Thread 9: 0 libsystem_kernel.dylib 0x00000001e40869e0 psynch_cvwait + 8 (:-1) 1 libsystem_pthread.dylib 0x00000001f2e2f584 _pthread_cond_wait$VARIANT$armv81 + 1220 (pthread_cond.c:636) 2 libc++.1.dylib 0x00000001b8e4f8b4 std::1::condition_variable::wait(std::__1::unique_lock&) + 24 (__threading_support:380) 3 hermes 0x000000010670d5ac 0x1065f0000 + 1168812 4 hermes 0x000000010670d360 0x1065f0000 + 1168224 5 libsystem_pthread.dylib 0x00000001f2e30060 _pthread_start + 116 (pthread.c:893) 6 libsystem_pthread.dylib 0x00000001f2e2e688 thread_start + 8 (:-1)

Thread 10 name: Thread 10: 0 libsystem_kernel.dylib 0x00000001e40869e0 psynch_cvwait + 8 (:-1) 1 libsystem_pthread.dylib 0x00000001f2e2f584 _pthread_cond_wait$VARIANT$armv81 + 1220 (pthread_cond.c:636) 2 libc++.1.dylib 0x00000001b8e4f8b4 std::1::condition_variable::wait(std::1::unique_lock&) + 24 (__threading_support:380) 3 PingMe 0x0000000104f54c74 void std::1::condition_variable::wait<facebook::hermes::inspector::detail::SerialExecutor::runLoop()::$_1>(std::1::unique_lock&, facebook::hermes::inspector::detail::SerialExec... + 28 (__mutex_base:404) 4 PingMe 0x0000000104f54c74 facebook::hermes::inspector::detail::SerialExecutor::runLoop() + 120 (SerialExecutor.cpp:41) 5 PingMe 0x0000000104f186ec decltype(static_cast<void (*>(fp)(static_cast<std::1::basic_string<char, std::1::char_traits, std::__1::allocator >>(fp0), static_cast<std::1::function<void ()>>(fp0))) std::1::... + 52 (type_traits:3918) 6 PingMe 0x0000000104f186ec void std::1::thread_execute<std::1::unique_ptr<std::1::thread_struct, std::1::default_delete >, void (*)(std::1::basic_string<char, std::1::char_traits<ch... + 56 (thread:287) 7 PingMe 0x0000000104f186ec void* std::1::thread_proxy<std::1::tuple<std::1::unique_ptr<std::1::thread_struct, std::1::default_delete >, void (*)(std::__1::basic_string<char, std::__1:... + 116 (thread:298) 8 libsystem_pthread.dylib 0x00000001f2e30060 _pthread_start + 116 (pthread.c:893) 9 libsystem_pthread.dylib 0x00000001f2e2e688 thread_start + 8 (:-1)

Thread 11 name: Thread 11: 0 libsystem_kernel.dylib 0x00000001e40869e0 psynch_cvwait + 8 (:-1) 1 libsystem_pthread.dylib 0x00000001f2e2f584 _pthread_cond_wait$VARIANT$armv81 + 1220 (pthread_cond.c:636) 2 libc++.1.dylib 0x00000001b8e4f8b4 std::1::condition_variable::wait(std::1::unique_lock&) + 24 (__threading_support:380) 3 PingMe 0x0000000104f54c74 void std::1::condition_variable::wait<facebook::hermes::inspector::detail::SerialExecutor::runLoop()::$_1>(std::1::unique_lock&, facebook::hermes::inspector::detail::SerialExec... + 28 (__mutex_base:404) 4 PingMe 0x0000000104f54c74 facebook::hermes::inspector::detail::SerialExecutor::runLoop() + 120 (SerialExecutor.cpp:41) 5 PingMe 0x0000000104f186ec decltype(static_cast<void (*>(fp)(static_cast<std::1::basic_string<char, std::1::char_traits, std::__1::allocator >>(fp0), static_cast<std::1::function<void ()>>(fp0))) std::1::... + 52 (type_traits:3918) 6 PingMe 0x0000000104f186ec void std::1::thread_execute<std::1::unique_ptr<std::1::thread_struct, std::1::default_delete >, void (*)(std::1::basic_string<char, std::1::char_traits<ch... + 56 (thread:287) 7 PingMe 0x0000000104f186ec void* std::1::thread_proxy<std::1::tuple<std::1::unique_ptr<std::1::thread_struct, std::1::default_delete >, void (*)(std::__1::basic_string<char, std::__1:... + 116 (thread:298) 8 libsystem_pthread.dylib 0x00000001f2e30060 _pthread_start + 116 (pthread.c:893) 9 libsystem_pthread.dylib 0x00000001f2e2e688 thread_start + 8 (:-1)

Thread 12 name: Thread 12: 0 libsystem_kernel.dylib 0x00000001e40869e0 psynch_cvwait + 8 (:-1) 1 libsystem_pthread.dylib 0x00000001f2e2f584 _pthread_cond_wait$VARIANT$armv81 + 1220 (pthread_cond.c:636) 2 libc++.1.dylib 0x00000001b8e4f8b4 std::1::condition_variable::wait(std::__1::unique_lock&) + 24 (__threading_support:380) 3 hermes 0x000000010670d5ac 0x1065f0000 + 1168812 4 hermes 0x000000010670d360 0x1065f0000 + 1168224 5 libsystem_pthread.dylib 0x00000001f2e30060 _pthread_start + 116 (pthread.c:893) 6 libsystem_pthread.dylib 0x00000001f2e2e688 thread_start + 8 (:-1)

Thread 13: 0 libsystem_pthread.dylib 0x00000001f2e2e674 start_wqthread + 0 (:-1)

Thread 14: 0 libsystem_pthread.dylib 0x00000001f2e2e674 start_wqthread + 0 (:-1)

Thread 15: 0 libsystem_pthread.dylib 0x00000001f2e2e674 start_wqthread + 0 (:-1)

Thread 16: 0 libsystem_pthread.dylib 0x00000001f2e2e674 start_wqthread + 0 (:-1)

Thread 17 name: Thread 17: 0 libsystem_kernel.dylib 0x00000001e40879f4 write + 8 (:-1) 1 Foundation 0x00000001a5a98d04 _NSWriteToFileDescriptorWithProgress + 192 (NSPlatform.m:613) 2 Foundation 0x00000001a5ab1cdc _NSWriteDataToFileWithExtendedAttributes_block_invoke + 68 (NSPlatform.m:1091) 3 Foundation 0x00000001a5a61f00 -[NSData(NSData) enumerateByteRangesUsingBlock:] + 112 (NSData.m:537) 4 Foundation 0x00000001a5a7eab0 _NSWriteDataToFileWithExtendedAttributes + 596 (NSPlatform.m:1088) 5 Foundation 0x00000001a5dc5a00 specialized DataStorage.withInteriorPointerReference(::) + 188 (:0) 6 Foundation 0x00000001a5dce510 specialized Data.Representation.withInteriorPointerReference(:) + 420 (Data.swift:0) 7 Foundation 0x00000001a5dd2228 Data.write(to:options:) + 64 (Data.swift:2284) 8 PingMe 0x0000000104cd65a8 FileStorage.write(:) + 196 (Storage.swift:0) 9 PingMe 0x0000000104cd6954 protocol witness for Storage.write(:) in conformance FileStorage + 20 (:0) 10 PingMe 0x0000000104cd3cc4 HeartbeatStorage.save(_:to:) + 156 (HeartbeatStorage.swift:151) 11 PingMe 0x0000000104cd4018 closure #1 in HeartbeatStorage.readAndWriteAsync(using:) + 240 (HeartbeatStorage.swift:111) 12 PingMe 0x0000000104c546bc thunk for @escaping @callee_guaranteed () > () + 28 (<compilergenerated>:0) 13 libdispatch.dylib 0x00000001b23b1850 _dispatch_call_block_and_release + 24 (init.c:1518) 14 libdispatch.dylib 0x00000001b23b27c8 _dispatch_client_callout + 16 (object.m:560) 15 libdispatch.dylib 0x00000001b238d854 _dispatch_lane_serial_drain$VARIANT$armv81 + 604 (inline_internal.h:2632) 16 libdispatch.dylib 0x00000001b238e2e4 _dispatch_lane_invoke$VARIANT$armv81 + 380 (queue.c:3940) 17 libdispatch.dylib 0x00000001b2398000 _dispatch_workloop_worker_thread + 612 (queue.c:6846) 18 libsystem_pthread.dylib 0x00000001f2e2eb50 _pthread_wqthread + 284 (pthread.c:2618) 19 libsystem_pthread.dylib 0x00000001f2e2e67c start_wqthread + 8 (:-1)

Thread 18 name: Thread 18: 0 libsystem_kernel.dylib 0x00000001e40879f4 write + 8 (:-1) 1 PingMe 0x0000000104ce4d18 FIRCLSFileLoopWithWriteBlock + 56 (FIRCLSFile.m:244) 2 PingMe 0x0000000104ce4c90 FIRCLSFileWriteWithRetries + 56 (FIRCLSFile.m:281) 3 PingMe 0x0000000104ce4c90 FIRCLSFileWriteToFileDescriptor + 68 (FIRCLSFile.m:219) 4 PingMe 0x0000000104ce4c90 FIRCLSFileWriteToFileDescriptorOrBuffer + 196 (FIRCLSFile.m:209) 5 PingMe 0x0000000104ce5204 FIRCLSFileWriteStringWithSuffix + 168 (FIRCLSFile.m:337) 6 PingMe 0x0000000104ce5058 FIRCLSFileWriteHashKey + 76 (FIRCLSFile.m:523) 7 PingMe 0x0000000104ce52a4 FIRCLSFileWriteHashEntryUint64 + 24 (FIRCLSFile.m:531) 8 PingMe 0x0000000104cd92f8 FIRCLSBinaryImageRecordDetails + 64 (FIRCLSBinaryImage.m:458) 9 PingMe 0x0000000104cd97d0 FIRCLSBinaryImageRecordSlice + 456 (FIRCLSBinaryImage.m:532) 10 PingMe 0x0000000104cd97d0 __FIRCLSBinaryImageChanged_block_invoke + 904 (FIRCLSBinaryImage.m:377) 11 libdispatch.dylib 0x00000001b23b1850 _dispatch_call_block_and_release + 24 (init.c:1518) 12 libdispatch.dylib 0x00000001b23b27c8 _dispatch_client_callout + 16 (object.m:560) 13 libdispatch.dylib 0x00000001b238d854 _dispatch_lane_serial_drain$VARIANT$armv81 + 604 (inline_internal.h:2632) 14 libdispatch.dylib 0x00000001b238e2e4 _dispatch_lane_invoke$VARIANT$armv81 + 380 (queue.c:3940) 15 libdispatch.dylib 0x00000001b2398000 _dispatch_workloop_worker_thread + 612 (queue.c:6846) 16 libsystem_pthread.dylib 0x00000001f2e2eb50 _pthread_wqthread + 284 (pthread.c:2618) 17 libsystem_pthread.dylib 0x00000001f2e2e67c start_wqthread + 8 (:-1)

Thread 19 name: Thread 19: 0 CoreFoundation 0x00000001a67003c4 CFStringHash + 120 (CFInternal.h:312) 1 CoreFoundation 0x00000001a6684ad4 -[NSDictionaryI objectForKey:] + 88 (NSDictionaryI.m:19) 2 PingMe 0x0000000104cf6964 __49

MusabBasheer commented 1 year ago

any update on this ??

kneth commented 1 year ago

@qusaieilouti99 Thank you for reporting. As you have noticed yourself, the crash has some similarities with https://github.com/realm/realm-js/issues/5026.

It would be nice to know if you only experience it on iOS and not Android?

qusaieilouti99 commented 1 year ago

Yeah it's only IOS, I'm able to run it fine on android and even on IOS debug mode. This crash is happening always and only on IOS release mode @kneth

qusaieilouti99 commented 1 year ago

See the Reproduction steps above I think anyone can reproduce it and for additional info, I forgot to say that I'm running on an M1 mac, it shouldn't be a big deal but just for info.

AndrewSerbin commented 1 year ago

I had the same issue yesterday, but today it works fine (magic!). my config is: react-native: 0.70.6, realm: 11.3.1, Hermes-engine is enabled.

MusabBasheer commented 1 year ago

@AndrewSerbin
Please can you show us what your pod file looks like ??

AndrewSerbin commented 1 year ago
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false

target 'ProjectName' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => FlipperConfiguration.enabled(['Debug'], { 'Flipper'=> '0.174.0' }),
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'ProjectNameTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end
atdyer commented 1 year ago

We're running into the same issue with our app. I've confirmed that this is reproducible using the Realm template app, and I've created an issue here: https://github.com/realm/realm-js/issues/5172

AndrewSerbin commented 1 year ago

hmm, looks like it is not working with expo based apps.

thespacemanatee commented 1 year ago

@qusaieilouti99 Thank you for reporting. As you have noticed yourself, the crash has some similarities with https://github.com/realm/realm-js/issues/5026.

It would be nice to know if you only experience it on iOS and not Android?

Hi @kneth , it's me again. This is also related to #4735, which the team has been reluctant to look into for 6 months now.

ElicaInc commented 1 year ago

same issue for me react-native: 0.70.6 realm: 11.3.1

zoobibackups commented 1 year ago

same issue on android

{
  "name": "XXXXXX",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "11.3.1": "^1.0.0",
    "@react-native-async-storage/async-storage": "^1.17.11",
    "@react-native-community/art": "^1.2.0",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/netinfo": "^8.0.0",
    "@react-native-google-signin/google-signin": "^9.0.2",
    "@react-navigation/drawer": "^6.5.6",
    "@react-navigation/material-top-tabs": "^6.5.1",
    "@react-navigation/native": "^6.1.1",
    "@react-navigation/native-stack": "^6.5.0",
    "google-libphonenumber": "^3.2.27",
    "libphonenumber-js": "^1.9.49",
    "lottie-react-native": "^5.1.4",
    "moment": "^2.29.1",
    "patch-package": "^6.5.0",
    "postinstall-postinstall": "^2.1.0",
    "react": "18.1.0",
    "react-native": "0.70.6",
    "react-native-admob-native-ads": "^0.6.0",
    "react-native-contacts": "^7.0.4",
    "react-native-gesture-handler": "^2.8.0",
    "react-native-google-mobile-ads": "^8.2.2",
    "react-native-image-crop-picker": "^0.39.0",
    "react-native-largelist-v3": "^3.1.0-rc.1",
    "react-native-linear-gradient": "^2.6.2",
    "react-native-modal": "^13.0.0",
    "react-native-pager-view": "^6.1.2",
    "react-native-paper": "^5.1.0",
    "react-native-permissions": "^3.6.1",
    "react-native-progress-wheel": "^1.0.5",
    "react-native-reanimated": "2.13.0",
    "react-native-responsive-fontsize": "^0.5.1",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-safe-area-context": "^3.4.1",
    "react-native-screens": "^3.18.2",
    "react-native-shimmer-placeholder": "^2.0.8",
    "react-native-splash-screen": "^3.3.0",
    "react-native-spring-scrollview": "3.0.2",
    "react-native-svg": "^12.1.1",
    "react-native-tab-view": "^3.3.4",
    "react-native-ultimate-config": "^3.4.2",
    "react-native-vector-icons": "^9.1.0",
    "realm": "11.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.17.5",
    "@babel/runtime": "^7.17.2",
    "@react-native-community/eslint-config": "^3.0.1",
    "babel-jest": "^27.5.1",
    "eslint": "^8.9.0",
    "jest": "^27.5.1",
    "metro-react-native-babel-preset": "^0.68.0",
    "react-native-svg-transformer": "^1.0.0",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}
ElicaInc commented 1 year ago

I found, in my case, adding following code to AppDelegate.m might reduce or resolve the crashes.

- (void)applicationDidEnterBackground:(UIApplication *)application
 {
  UIBackgroundTaskIdentifier taskId = [application beginBackgroundTaskWithExpirationHandler:nil];
  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    // do nothing for 4.7 seconds
    [NSThread sleepForTimeInterval:4.7f];
    [application endBackgroundTask:taskId];
  });
 }

I am not sure if the crashes depend on Realm. Does Realm work something after entering background?

takameyer commented 1 year ago

Hey all, this issue has now been solved. See #4735. There was an issue with how expo binds its packages to the JS runtime, which was coming into conflict with Realm and other third party libraries. There should be a fix for this by expo in either expo@47.0.9 or expo@46.0.19.

Steven-Thelin commented 1 year ago

In case others still end up here by encountering this in non-expo RN-cli apps, my fix was almost similar.

I didn't pay attention to the release version of Realm. Having tried the latest + every version i saw on all GitHub issues/StackOverflow posts, i finally pointed my attention to comparing my React Native version to the appropriate match in the compatability matrix. (In my case RN 0.70.4, and realm 11.3.1. Probably one of the only versions i never tried)

The version match between Realm and React Native makes a huge impact (in my case, the app crashed on open). Not even using realm@hermes worked for me. Now it works fine without (even while using reanimated2)