Skip to content

Swift runtime trap in dispatchAsyncOnMainQueueIfNotMainThread: with concurrent SentryFileManagerHelper write #6131

@saeed4u

Description

@saeed4u

What React Native libraries do you use?

React Navigation, Hermes, RN New Architecture, Expo (mobile only)

Are you using sentry.io or on-premise?

on-premise (Self-Hosted)

Are you using any other error monitoring solution alongside Sentry?

No

Other Error Monitoring Solution Name

No response

@sentry/react-native SDK Version

8.10.0

How does your development environment look like?

⬇  Place the `npx react-native@latest info` output here. ⬇

System:
  OS: macOS 26.4
  CPU: (10) arm64 Apple M5
  Memory: 305.02 MB / 24.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 25.9.0
    path: /Users/seidu/.nvm/versions/node/v25.9.0/bin/node
  Yarn:
    version: 4.12.0
    path: /opt/homebrew/bin/yarn
  npm:
    version: 11.12.1
    path: /Users/seidu/.nvm/versions/node/v25.9.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.4
      - iOS 26.4
      - macOS 26.4
      - tvOS 26.4
      - visionOS 26.4
      - watchOS 26.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.3 AI-253.31033.145.2533.15113396
  Xcode:
    version: 26.4.1/17E202
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.10
    path: /opt/homebrew/opt/openjdk@21/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.1.3
    wanted: 20.1.3
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.81.5
    wanted: 0.81.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true


Sentry.init()

Sentry.init({
  dsn: '...'
 tracesSampleRate: 0.1,
 patchGlobalPromise: false,
 denyUrls: ['localhost', '127.0.0.1'],
  replaysOnErrorSampleRate: 1,
  replaysSessionSampleRate: 0,
});

Steps to Reproduce

Note: We are not able to reproduce this
In our production traffic, it affects less than 1% of cold launches on iOS 26+.
We have not been able to reproduce it with an Xcode-attached debug build or with TestFlight/Release builds on physical devices

Expected Result

App launches normally.

Actual Result

OS Version: iOS 26.5 (23F75)
Report Version: 104

Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0 at 0x00000001015a8e70
Crashed Thread: 0

Application Specific Information:
crash

Thread 0 Crashed:
0 Tonie-App 0x2015a8e70 +[SentrySDKInternal crash] (SentrySDKInternal.m:701)
1 CoreFoundation 0x3256758f4
2 CoreFoundation 0x325675778
3 CoreFoundation 0x32568b428
4 React 0x1034b076c facebook::react::ObjCTurboModule::performVoidMethodInvocation
5 React 0x1034b5938 std::__1::__function::__func::operator()
6 libdispatch.dylib 0x399e559a8
7 libdispatch.dylib 0x399e6f1e4
8 libdispatch.dylib 0x399e8ce10
9 libdispatch.dylib 0x399e64964
10 libdispatch.dylib 0x399e648a4 _dispatch_main_queue_callback_4CF
11 CoreFoundation 0x3256b4030
12 CoreFoundation 0x325641604
13 CoreFoundation 0x32564054c
14 GraphicsServices 0x47053d498 GSEventRunModal
15 UIKitCore 0x330f3f244
16 UIKitCore 0x330eaa158 UIApplicationMain
17 UIKitCore 0x3310b6618
18 Tonie-App 0x2006213c4 [inlined] $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ9Tonie_App0fB0C_Ttg5
19 Tonie-App 0x2006213c4 [inlined] AppDelegate.$main (:11)
20 Tonie-App 0x2006213c4 main
21 dyld 0x31ee86c1c

Thread 0 Crashed:
0 Tonie-App 0x2015a8e70 +[SentrySDKInternal crash] (SentrySDKInternal.m:701)
1 CoreFoundation 0x3256758f4
2 CoreFoundation 0x325675778
3 CoreFoundation 0x32568b428
4 React 0x1034b076c facebook::react::ObjCTurboModule::performVoidMethodInvocation
5 React 0x1034b5938 std::__1::__function::__func::operator()
6 libdispatch.dylib 0x399e559a8
7 libdispatch.dylib 0x399e6f1e4
8 libdispatch.dylib 0x399e8ce10
9 libdispatch.dylib 0x399e64964
10 libdispatch.dylib 0x399e648a4 _dispatch_main_queue_callback_4CF
11 CoreFoundation 0x3256b4030
12 CoreFoundation 0x325641604
13 CoreFoundation 0x32564054c
14 GraphicsServices 0x47053d498 GSEventRunModal
15 UIKitCore 0x330f3f244
16 UIKitCore 0x330eaa158 UIApplicationMain
17 UIKitCore 0x3310b6618
18 Tonie-App 0x2006213c4 [inlined] $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ9Tonie_App0fB0C_Ttg5
19 Tonie-App 0x2006213c4 [inlined] AppDelegate.$main (:11)
20 Tonie-App 0x2006213c4 main
21 dyld 0x31ee86c1c

Thread 1 name: GC Timer thread
0 libsystem_kernel.dylib 0x4831865e8 __psynch_cvwait
1 libsystem_pthread.dylib 0x3e39fab48
2 libc++.1.dylib 0x34447b3dc std::__1::condition_variable::__do_timed_wait
3 Usercentrics 0x1040b7bc8 kotlin::RepeatedTimer::Run
4 Usercentrics 0x1040b7e50 std::__1::__thread_proxy
5 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 2 name: Main GC thread
0 libsystem_kernel.dylib 0x4831865e8 __psynch_cvwait
1 libsystem_pthread.dylib 0x3e39fab48
2 libc++.1.dylib 0x344476bcc std::__1::condition_variable::wait
3 Usercentrics 0x1040ba924 kotlin::ScopedThread::Run
4 Usercentrics 0x1040bd468 std::__1::__thread_proxy
5 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 3 name: com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x483180cd4 mach_msg2_trap
1 libsystem_kernel.dylib 0x48318430c mach_msg2_internal
2 libsystem_kernel.dylib 0x48318422c mach_msg_overwrite
3 libsystem_kernel.dylib 0x483184078 mach_msg
4 CoreFoundation 0x325677344
5 CoreFoundation 0x325641310
6 CoreFoundation 0x32564054c
7 Foundation 0x31fb40cf0
8 Foundation 0x31fb40bd8
9 UIKitCore 0x330f04a7c
10 Foundation 0x31fbc4824
11 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 4 name: com.facebook.react.runtime.JavaScript
0 hermesvm 0x10459fac8 hermes::vm::Interpreter::interpretFunction
1 hermesvm 0x10459da08 hermes::vm::Runtime::interpretFunctionImpl
2 hermesvm 0x104591bc0 hermes::vm::JSFunction::_callImpl
3 hermesvm 0x104590a84 hermes::vm::Callable::executeCall0
4 hermesvm 0x1045c23c4 hermes::vm::Runtime::drainJobs
5 hermesvm 0x1045738b0 facebook::hermes::(anonymous namespace)::HermesRuntimeImpl::drainMicrotasks
6 React 0x1034147d0 facebook::react::RuntimeScheduler_Modern::performMicrotaskCheckpoint
7 React 0x103414664 facebook::react::RuntimeScheduler_Modern::runEventLoopTick
8 React 0x1034143d8 facebook::react::RuntimeScheduler_Modern::runEventLoop
9 React 0x10343063c std::__1::__function::__func::operator()
10 React 0x103251d58 facebook::react::tryAndReturnError
11 React 0x10324cce0 facebook::react::RCTMessageThread::tryFunc
12 React 0x10324cae4 facebook::react::RCTMessageThread::runAsync
13 CoreFoundation 0x32563facc
14 CoreFoundation 0x32563f798
15 CoreFoundation 0x3256417a0
16 CoreFoundation 0x32564054c
17 React 0x10344636c +[RCTJSThreadManager runRunLoop]
18 Foundation 0x31fbc4824
19 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 5 name: hades
0 libsystem_kernel.dylib 0x4831865e8 __psynch_cvwait
1 libsystem_pthread.dylib 0x3e39fab48
2 libc++.1.dylib 0x344476bcc std::__1::condition_variable::wait
3 hermesvm 0x1046126bc hermes::vm::HadesGC::Executor::worker
4 hermesvm 0x104612630 std::__1::__thread_proxy[abi:nn190102]
5 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 6 name: hades
0 libsystem_kernel.dylib 0x4831865e8 __psynch_cvwait
1 libsystem_pthread.dylib 0x3e39fab48
2 libc++.1.dylib 0x344476bcc std::__1::condition_variable::wait
3 hermesvm 0x1046126bc hermes::vm::HadesGC::Executor::worker
4 hermesvm 0x104612630 std::__1::__thread_proxy[abi:nn190102]
5 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 7 name: video-metadata-runtime_queue
0 libsystem_kernel.dylib 0x4831865e8 __psynch_cvwait
1 libsystem_pthread.dylib 0x3e39fab48
2 libc++.1.dylib 0x344476bcc std::__1::condition_variable::wait
3 Tonie-App 0x201495a9c [inlined] std::__1::condition_variable::wait[abi:nqe210106] (condition_variable.h:112)
4 Tonie-App 0x201495a9c [inlined] worklets::AsyncQueueImpl::AsyncQueueImpl::lambda::operator() (AsyncQueueImpl.cpp:17)
5 Tonie-App 0x201495a9c [inlined] std::__1::__invoke[abi:nqe210106] (invoke.h:87)
6 Tonie-App 0x201495a9c [inlined] std::__1::__thread_execute[abi:nqe210106] (thread.h:159)
7 Tonie-App 0x201495a9c std::__1::__thread_proxy[abi:nqe210106] (thread.h:168)
8 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 8 name: hades
0 libsystem_kernel.dylib 0x4831865e8 __psynch_cvwait
1 libsystem_pthread.dylib 0x3e39fab48
2 libc++.1.dylib 0x344476bcc std::__1::condition_variable::wait
3 hermesvm 0x1046126bc hermes::vm::HadesGC::Executor::worker
4 hermesvm 0x104612630 std::__1::__thread_proxy[abi:nn190102]
5 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 9 name: video-metadata-runtime(timeout)
0 libsystem_kernel.dylib 0x4831865e8 __psynch_cvwait
1 libsystem_pthread.dylib 0x3e39fab48
2 libc++.1.dylib 0x344476bcc std::__1::condition_variable::wait
3 Tonie-App 0x201498630 [inlined] worklets::EventLoop::run::lambda::operator() (EventLoop.cpp:36)
4 Tonie-App 0x201498630 [inlined] std::__1::__invoke[abi:nqe210106] (invoke.h:87)
5 Tonie-App 0x201498630 [inlined] std::__1::__thread_execute[abi:nqe210106] (thread.h:159)
6 Tonie-App 0x201498630 std::__1::__thread_proxy[abi:nqe210106] (thread.h:168)
7 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 10
0 libsystem_kernel.dylib 0x483186808 __semwait_signal
1 libsystem_c.dylib 0x33cc9a82c nanosleep
2 libsystem_c.dylib 0x33cc9a954 sleep
3 Tonie-App 0x20155ad54 monitorCachedData (SentryCrashCachedData.c:146)
4 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 11 name: SentryCrash Exception Handler (Secondary)
0 libsystem_kernel.dylib 0x483180cd4 mach_msg2_trap
1 libsystem_kernel.dylib 0x48318430c mach_msg2_internal
2 libsystem_kernel.dylib 0x48318422c mach_msg_overwrite
3 libsystem_kernel.dylib 0x483184078 mach_msg
4 Tonie-App 0x201565050 handleExceptions (SentryCrashMonitor_MachException.c:313)
5 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 13 name: io.sentry.app-hang-tracker
0 libsystem_kernel.dylib 0x483186808 __semwait_signal
1 libsystem_c.dylib 0x33cc9a82c nanosleep
2 Foundation 0x31fe4afa8
3 Tonie-App 0x201547d14 -[SentryANRTrackerV1 detectANRs] (SentryANRTrackerV1.m:108)
4 Foundation 0x31fbc4824
5 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 14 name: com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x483180cd4 mach_msg2_trap
1 libsystem_kernel.dylib 0x48318430c mach_msg2_internal
2 libsystem_kernel.dylib 0x48318422c mach_msg_overwrite
3 libsystem_kernel.dylib 0x483184078 mach_msg
4 CoreFoundation 0x325677344
5 CoreFoundation 0x325641310
6 CoreFoundation 0x32564054c
7 CFNetwork 0x34ff43b54
8 Foundation 0x31fbc4824
9 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 15 name: Log work queue
0 libsystem_kernel.dylib 0x483180c50 semaphore_wait_trap
1 WebKit 0x35c632804
2 JavaScriptCore 0x3507039b4
3 JavaScriptCore 0x35070716c
4 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 16 name: com.apple.CFStream.LegacyThread
0 libsystem_kernel.dylib 0x483180cd4 mach_msg2_trap
1 libsystem_kernel.dylib 0x48318430c mach_msg2_internal
2 libsystem_kernel.dylib 0x48318422c mach_msg_overwrite
3 libsystem_kernel.dylib 0x483184078 mach_msg
4 CoreFoundation 0x325677344
5 CoreFoundation 0x325641310
6 CoreFoundation 0x32564054c
7 CoreFoundation 0x325709848
8 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 17
0 libsystem_kernel.dylib 0x4831865e8 __psynch_cvwait
1 libsystem_pthread.dylib 0x3e39fab48
2 Usercentrics 0x1040cb44c (anonymous namespace)::waitInNativeState
3 Usercentrics 0x1040ca664 (anonymous namespace)::workerRoutine
4 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 18 name: GC finalizer processor
0 libsystem_kernel.dylib 0x483180cd4 mach_msg2_trap
1 libsystem_kernel.dylib 0x48318430c mach_msg2_internal
2 libsystem_kernel.dylib 0x48318422c mach_msg_overwrite
3 libsystem_kernel.dylib 0x483184078 mach_msg
4 CoreFoundation 0x325677344
5 CoreFoundation 0x325641310
6 CoreFoundation 0x32564054c
7 CoreFoundation 0x3256f0d64 CFRunLoopRun
8 Usercentrics 0x1040be28c kotlin::ScopedThread::Run
9 Usercentrics 0x1040be354 std::__1::__thread_proxy
10 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 19
0 libsystem_kernel.dylib 0x483180a80 __workq_kernreturn
1 libsystem_pthread.dylib 0x3e39f93fc _pthread_wqthread

Thread 20
0 libsystem_kernel.dylib 0x483180a80 __workq_kernreturn
1 libsystem_pthread.dylib 0x3e39f93fc _pthread_wqthread

Thread 21
0 libsystem_kernel.dylib 0x483180a80 __workq_kernreturn
1 libsystem_pthread.dylib 0x3e39f93fc _pthread_wqthread

Thread 22
0 libsystem_kernel.dylib 0x483180c50 semaphore_wait_trap
1 caulk 0x559391c6c caulk::semaphore::timed_wait
2 caulk 0x559391cb8
3 caulk 0x559395f54
4 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 23
0 libsystem_kernel.dylib 0x483180c50 semaphore_wait_trap
1 caulk 0x559391c6c caulk::semaphore::timed_wait
2 caulk 0x559391cb8
3 caulk 0x559395f54
4 libsystem_pthread.dylib 0x3e39fc438 _pthread_start

Thread 24
0 libsystem_kernel.dylib 0x483186784 __open
1 libsystem_kernel.dylib 0x483186770 open
2 ImageIO 0x32b38c140
3 ImageIO 0x32b38c024
4 ImageIO 0x32b373954
5 ImageIO 0x32b373468 CGImageSourceCreateWithURL
6 UIKitCore 0x33112a8bc
7 UIKitCore 0x331130ac4
8 UIKitCore 0x3311308e8
9 Tonie-App 0x20160b168 [inlined] UIImage.init
10 Tonie-App 0x20160b168 [inlined] UIImage.__allocating_init (UIImage.h:129)
11 Tonie-App 0x20160b168 SentryOnDemandReplay.renderVideo (SentryOnDemandReplay.swift:232)
12 Tonie-App 0x201608964 [inlined] SentryOnDemandReplay.renderVideo
13 Tonie-App 0x201608964 SentryOnDemandReplay.createVideoWith (SentryOnDemandReplay.swift:180)
14 Tonie-App 0x20160809c closure in SentryOnDemandReplay.createVideoInBackgroundWith (SentryOnDemandReplay.swift:154)
15 Tonie-App 0x20062f780 thunk for closure
16 Tonie-App 0x2015460f0 __62-[_SentryDispatchQueueWrapperInternal dispatchAsyncWithBlock:]_block_invoke (_SentryDispatchQueueWrapperInternal.m:30)
17 libdispatch.dylib 0x399e559a8
18 libdispatch.dylib 0x399e6f1e4
19 libdispatch.dylib 0x399e5dfb0
20 libdispatch.dylib 0x399e5eaac
21 libdispatch.dylib 0x399e68dac
22 libdispatch.dylib 0x399e686ac
23 libsystem_pthread.dylib 0x3e39f93b0 _pthread_wqthread

Thread 25
0 CoreGraphics 0x32725dfa8
1 CoreGraphics 0x327281180
2 CoreGraphics 0x3271fd1b4
3 CoreGraphics 0x3271fd0cc
4 CoreGraphics 0x3271f34a0
5 CoreGraphics 0x3271f1c7c CGContextDrawImageWithOptions
6 CoreGraphics 0x3271f1778 CGContextDrawImage
7 UIKitCore 0x33120ccf4
8 UIKitCore 0x33120c964
9 Tonie-App 0x2015ee4ac SentryDefaultMaskRenderer.applyMasking (SentryDefaultMaskRenderer.swift:28)
10 Tonie-App 0x2015eeb5c [inlined] SentryDefaultMaskRenderer.applyMasking
11 Tonie-App 0x2015eeb5c [inlined] SentryDefaultMaskRenderer.applyMasking (:14)
12 Tonie-App 0x2015eeb5c [inlined] closure in SentryMaskRendererV2.maskScreenshot (SentryMaskRendererV2.swift:12)
13 Tonie-App 0x2015eeb5c [inlined] closure in SentryMaskRendererV2.maskScreenshot
14 Tonie-App 0x2015eeb5c SentryGraphicsImageRenderer.image (SentryGraphicsImageRenderer.swift:85)
15 Tonie-App 0x2015fbf30 [inlined] SentryGraphicsImageRenderer.image
16 Tonie-App 0x2015fbf30 SentryMaskRendererV2.maskScreenshot (SentryMaskRendererV2.swift:10)
17 Tonie-App 0x2006c6064 SentryDefaultMaskRenderer
18 Tonie-App 0x2016585e8 closure in SentryViewPhotographer.image (SentryViewPhotographer.swift:51)
19 Tonie-App 0x20062f780 thunk for closure
20 Tonie-App 0x2015460f0 __62-[_SentryDispatchQueueWrapperInternal dispatchAsyncWithBlock:]_block_invoke (_SentryDispatchQueueWrapperInternal.m:30)
21 libdispatch.dylib 0x399e559a8
22 libdispatch.dylib 0x399e6f1e4
23 libdispatch.dylib 0x399e5dfb0
24 libdispatch.dylib 0x399e5eaac
25 libdispatch.dylib 0x399e68dac
26 libdispatch.dylib 0x399e686ac
27 libsystem_pthread.dylib 0x3e39f93b0 _pthread_wqthread

Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000101ef7b70 x1: 0x0000000101b46ef4 x2: 0x0000000000000000 x3: 0x0000000000000000
x4: 0x0000000000000000 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x0000000000000000
x8: 0x00000000ffffe034 x9: 0x0000000000000103 x10: 0x00000000005b156c x11: 0x0000000000000009
x12: 0x0000000000000009 x13: 0x0000000000000000 x14: 0x0000000137804380 x15: 0x000000014443c000
x16: 0x0000000101ef7b9a x17: 0x00000001015a8e70 x18: 0x0000000000000000 x19: 0x00000001390fe8c0
x20: 0x00000002042c3d98 x21: 0x000000019ece3400 x22: 0x00000001441ae080 x23: 0x00000001441ae1c0
x24: 0x0000000111d10200 x25: 0x0000000000000000 x26: 0x0000000000000114 x27: 0x0000000000000000
x28: 0xffffffff76ffffff fp: 0x000000016f7e6230 lr: 0x00000001a21908f4 sp: 0x000000016f7e6220
pc: 0x00000001015a8e70 cpsr: 0x0000000040001400

EOF

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions