Instabug / Instabug-React-Native

In-app feedback and bug reporting tool for React Native
https://instabug.com/platforms/react-native
MIT License
312 stars 100 forks source link

Calling APM.startExecutionTrace when APM is not enabled causes crash on iOS #687

Closed lachenmayer closed 2 years ago

lachenmayer commented 2 years ago

Steps to Reproduce the Problem

Expected Behavior

Actual Behavior

Error - Execution trace "Query" wasn't created. Please make sure to enable APM first by following the instructions at this link: https://docs.instabug.com/reference#enable-or-disable-apm{
node_modules/instabug-reactnative/modules/APM.jsIBGAPM.startExecutionTrace$argument_2 97 31
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js__invokeCallback     465 12
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js__guard$argument_0   127 11
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js__guard              370 8
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.jsinvokeCallbackAndReturnFlushedQueue 126 9
[native code]value                 
}

(Captured via Instabug crash reporting - let me know if you want to see the actual crash)

Instabug integration code

Instabug.start('token', [Instabug.invocationEvent.shake])

SDK Version

10.13.0

React Native, iOS and Android Versions

React Native 0.66.4 iOS 15.3.1

Further comments

DavidMina96 commented 2 years ago

@lachenmayer Thank you for reporting this. We're looking into it. Regarding your plan, you can reach out to us at support@instabug.com to sort this out for you.

lachenmayer commented 2 years ago

Thanks a lot!

DavidMina96 commented 2 years ago

@lachenmayer Happy to help! Could you please share with us the full crash stack trace as well as the exact code snippet you use to start an execution trace as this crash isn't reproducible yet on our side?

lachenmayer commented 2 years ago

Hi David, here's the full crash as exported from Instabug:

Click to expand ``` data:text/text;charset=utf-8, # Cause: Unhandled JS Exception: Error: Execution trace "Query" wasn't created. Please make sure to enable APM first by following the instructions at this link: https://docs.instabug.c..., stack: @1471:864 value@59:3867 @59:913 value@59:2582 value@59:883 value@(null):(null) # Reported at: 2022-04-07 11:31:36 UTC Thread 0: 0 libsystem_platform.dylib 0x1f23aae0c _platform_memset + 140 1 libsystem_malloc.dylib 0x192d21084 $szone_malloc_should_clear + 119 2 libsystem_malloc.dylib 0x192d1f084 _malloc_zone_calloc + 87 3 CoreFoundation 0x180fa6dac _CFBasicHashRehash + 347 4 Foundation 0x18283e408 -[NSKeyedArchiver _initWithOutput:] + 283 5 Foundation 0x182846140 +[NSKeyedArchiver archivedDataWithRootObject:] + 95 6 Instabug 0x102aca888 $specialized static AESEncryptor.encrypt(object:key:) (AESEncryptor.swift:13) 7 Instabug 0x102ac5a98 InstabugUserDefaults.ibg_secureSetObject(_:forKey:) (InstabugUserDefaults.swift:90) 8 Instabug 0x102ac5e00 @objc InstabugUserDefaults.ibg_secureSetBool(_:forKey:) (:100) 9 Instabug 0x102aef39c -[IBGFeatures setFeatureOfName:toValue:isUserSet:] (IBGFeatures.m:569) 10 Instabug 0x102aef1c0 -[IBGFeatures JSONSetFeature:toValue:] (IBGFeatures.m:546) 11 Instabug 0x102aedf98 -[IBGFeatures updateFeaturesWithFeaturesResponse:] (IBGFeatures.m:393) 12 Instabug 0x1029c3cf4 -[IBGFeaturesNetworkManager featuresRequestDone:isSuccess:error:response:shouldUpdateFeatures:] (IBGFeaturesNetworkManager.m:128) 13 Instabug 0x1029f49cc -[IBGFeaturesRequest networkDone:URLSessionDataTask:response:error:responseDictionary:] (IBGFeaturesRequest.m:74) 14 Instabug 0x102a71d68 _51-[IBGNetwork URLSession:task:didCompleteWithError:]_block_invoke_2 (IBGNetwork.m:313) 15 libdispatch.dylib 0x180ca1924 _dispatch_call_block_and_release + 31 16 libdispatch.dylib 0x180ca3670 _dispatch_client_callout + 19 17 libdispatch.dylib 0x180cb1b70 _dispatch_main_queue_callback_4CF + 943 18 CoreFoundation 0x180fe9d84 _CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 15 19 CoreFoundation 0x180fa3f5c _CFRunLoopRun + 2539 20 CoreFoundation 0x180fb7468 CFRunLoopRunSpecific + 599 21 GraphicsServices 0x19cb5b38c GSEventRunModal + 163 22 UIKitCore 0x18395a5d0 -[UIApplication _run] + 1099 23 UIKitCore 0x1836d8f74 UIApplicationMain + 363 24 Picnic 0x10028290c 0x10027c000 Thread 1: 0 libsystem_kernel.dylib 0x1b86edb2c _workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 2: 0 libsystem_kernel.dylib 0x1b86edb2c _workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 3: 0 libsystem_kernel.dylib 0x1b86edb2c _workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 4: 0 libsystem_kernel.dylib 0x1b86ed558 $semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x180ca4280 _dispatch_semaphore_wait_slow + 75 2 Picnic 0x100734b28 0x10027c000 3 libdispatch.dylib 0x180ca1924 _dispatch_call_block_and_release + 31 4 libdispatch.dylib 0x180ca3670 _dispatch_client_callout + 19 5 libdispatch.dylib 0x180ca6798 _dispatch_queue_override_invoke + 791 6 libdispatch.dylib 0x180cb4de0 _dispatch_root_queue_drain + 395 7 libdispatch.dylib 0x180cb5608 _dispatch_worker_thread2 + 163 8 libsystem_pthread.dylib 0x1f23b30b8 _pthread_wqthread + 227 9 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 5: 0 libsystem_kernel.dylib 0x1b86ed504 mach_msg_trap + 8 1 CoreFoundation 0x180f9f738 _CFRunLoopServiceMachPort + 371 2 CoreFoundation 0x180fa3a2c _CFRunLoopRun + 1211 3 CoreFoundation 0x180fb7468 CFRunLoopRunSpecific + 599 4 Foundation 0x1827d5c84 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 235 5 Foundation 0x182816db8 -[NSRunLoop(NSRunLoop) runUntilDate:] + 91 6 UIKitCore 0x1838d374c -[UIEventFetcher threadMain] + 523 7 Foundation 0x1828253fc _NSThread__start__ + 807 8 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 9 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 6: 0 libsystem_kernel.dylib 0x1b86ed558 $semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x180ca4280 _dispatch_semaphore_wait_slow + 75 2 Picnic 0x1007dcef8 0x10027c000 3 libdispatch.dylib 0x180ca1924 _dispatch_call_block_and_release + 31 4 libdispatch.dylib 0x180ca3670 _dispatch_client_callout + 19 5 libdispatch.dylib 0x180ca6798 _dispatch_queue_override_invoke + 791 6 libdispatch.dylib 0x180cb4de0 _dispatch_root_queue_drain + 395 7 libdispatch.dylib 0x180cb5608 _dispatch_worker_thread2 + 163 8 libsystem_pthread.dylib 0x1f23b30b8 _pthread_wqthread + 227 9 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 7: 0 libsystem_kernel.dylib 0x1b86edb2c _workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 8: 0 libsystem_kernel.dylib 0x1b86ed504 mach_msg_trap + 8 1 CoreFoundation 0x180f9f738 _CFRunLoopServiceMachPort + 371 2 CoreFoundation 0x180fa3a2c _CFRunLoopRun + 1211 3 CoreFoundation 0x180fb7468 CFRunLoopRunSpecific + 599 4 Picnic 0x100553218 0x10027c000 5 Foundation 0x1828253fc _NSThread__start__ + 807 6 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 7 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 9: 0 libsystem_kernel.dylib 0x1b86edf90 _psynch_cvwait + 8 1 libc++.1.dylib 0x19991bddc $std::__1::condition_variable::wait(std::__1::unique_lock&) + 27 2 JavaScriptCore 0x18d195174 void std::__1::condition_variable_any::wait >(std::__1::unique_lock&) + 107 3 JavaScriptCore 0x18d199944 bmalloc::Scavenger::threadRunLoop() + 339 4 JavaScriptCore 0x18d1994e4 bmalloc::Scavenger::threadEntryPoint(bmalloc::Scavenger*) + 15 5 JavaScriptCore 0x18d19a9a0 void* std::__1::__thread_proxy >, void (*)(bmalloc::Scavenger*), bmalloc::Scavenger*> >(void*) + 47 6 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 7 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 10: 0 libsystem_kernel.dylib 0x1b86ed504 mach_msg_trap + 8 1 CoreFoundation 0x180f9f738 _CFRunLoopServiceMachPort + 371 2 CoreFoundation 0x180fa3a2c _CFRunLoopRun + 1211 3 CoreFoundation 0x180fb7468 CFRunLoopRunSpecific + 599 4 AudioSession 0x18a3d2308 CADeprecated::GenericRunLoopThread::Entry(void*) + 163 5 AudioSession 0x18a3dbd64 CADeprecated::CAPThread::Entry(CADeprecated::CAPThread*) + 91 6 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 7 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 11: 0 libsystem_kernel.dylib 0x1b86ed504 mach_msg_trap + 8 1 CoreFoundation 0x180f9f738 _CFRunLoopServiceMachPort + 371 2 CoreFoundation 0x180fa3a2c _CFRunLoopRun + 1211 3 CoreFoundation 0x180fb7468 CFRunLoopRunSpecific + 599 4 CFNetwork 0x181a2d510 0x0000000180ddd50f + 463 5 Foundation 0x1828253fc _NSThread__start__ + 807 6 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 7 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 12: 0 libsystem_kernel.dylib 0x1b86edf90 _psynch_cvwait + 8 1 JavaScriptCore 0x18d11c2b4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda const&, WTF::ScopedLambda const&, WTF::TimeWithDynamicClockType const&) + 2755 2 JavaScriptCore 0x18cfd7c3c bool WTF::Condition::waitUntilUnchecked(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 195 3 JavaScriptCore 0x18d0e6ce0 WTF::Detail::CallableWrapper::call() + 259 4 JavaScriptCore 0x18d14219c WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 275 5 JavaScriptCore 0x18d144af8 WTF::wtfThreadEntryPoint(void*) + 15 6 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 7 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 13: 0 libsystem_kernel.dylib 0x1b86edf90 _psynch_cvwait + 8 1 JavaScriptCore 0x18d11c2b4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda const&, WTF::ScopedLambda const&, WTF::TimeWithDynamicClockType const&) + 2755 2 JavaScriptCore 0x18cfd7c3c bool WTF::Condition::waitUntilUnchecked(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 195 3 JavaScriptCore 0x18d0e6ce0 WTF::Detail::CallableWrapper::call() + 259 4 JavaScriptCore 0x18d14219c WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 275 5 JavaScriptCore 0x18d144af8 WTF::wtfThreadEntryPoint(void*) + 15 6 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 7 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 14: 0 libsystem_kernel.dylib 0x1b86edf90 _psynch_cvwait + 8 1 JavaScriptCore 0x18d11c2b4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda const&, WTF::ScopedLambda const&, WTF::TimeWithDynamicClockType const&) + 2755 2 JavaScriptCore 0x18cfd7c3c bool WTF::Condition::waitUntilUnchecked(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 195 3 JavaScriptCore 0x18d0e6ce0 WTF::Detail::CallableWrapper::call() + 259 4 JavaScriptCore 0x18d14219c WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 275 5 JavaScriptCore 0x18d144af8 WTF::wtfThreadEntryPoint(void*) + 15 6 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 7 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 15: 0 libsystem_kernel.dylib 0x1b86edf90 _psynch_cvwait + 8 1 JavaScriptCore 0x18d11c2b4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda const&, WTF::ScopedLambda const&, WTF::TimeWithDynamicClockType const&) + 2755 2 JavaScriptCore 0x18cfd7c3c bool WTF::Condition::waitUntilUnchecked(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 195 3 JavaScriptCore 0x18d0e6ce0 WTF::Detail::CallableWrapper::call() + 259 4 JavaScriptCore 0x18d14219c WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 275 5 JavaScriptCore 0x18d144af8 WTF::wtfThreadEntryPoint(void*) + 15 6 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 7 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 16: 0 libsystem_kernel.dylib 0x1b86edf90 _psynch_cvwait + 8 1 JavaScriptCore 0x18d11c2b4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda const&, WTF::ScopedLambda const&, WTF::TimeWithDynamicClockType const&) + 2755 2 JavaScriptCore 0x18cfd7c3c bool WTF::Condition::waitUntilUnchecked(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 195 3 JavaScriptCore 0x18d0e6ce0 WTF::Detail::CallableWrapper::call() + 259 4 JavaScriptCore 0x18d14219c WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 275 5 JavaScriptCore 0x18d144af8 WTF::wtfThreadEntryPoint(void*) + 15 6 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 7 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 17: 0 libsystem_kernel.dylib 0x1b86edf90 _psynch_cvwait + 8 1 JavaScriptCore 0x18d11c2b4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda const&, WTF::ScopedLambda const&, WTF::TimeWithDynamicClockType const&) + 2755 2 JavaScriptCore 0x18cfd7c3c bool WTF::Condition::waitUntilUnchecked(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 195 3 JavaScriptCore 0x18d0e6ce0 WTF::Detail::CallableWrapper::call() + 259 4 JavaScriptCore 0x18d14219c WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 275 5 JavaScriptCore 0x18d144af8 WTF::wtfThreadEntryPoint(void*) + 15 6 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 7 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 18: 0 libsystem_kernel.dylib 0x1b86ed504 mach_msg_trap + 8 1 Instabug 0x102c7fea8 exception_server_thread (PLCrashMachExceptionServer.m:674) 2 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 3 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 19: 0 libsystem_malloc.dylib 0x192d3080c nanov2_calloc + 160 1 libsystem_malloc.dylib 0x192d1f084 _malloc_zone_calloc + 87 2 CoreFoundation 0x180fa6e30 _CFBasicHashRehash + 479 3 CoreFoundation 0x180fb8784 _CFBasicHashAddValue + 103 4 CoreFoundation 0x180fac2a0 CFBasicHashAddValue + 2107 5 CoreFoundation 0x180fb4c14 _CFPropertyListIsValidAux + 487 6 CoreFoundation 0x1810622f8 CFPropertyListIsValid + 63 7 CFNetwork 0x1818d5b18 0x0000000180c85b17 + 287 8 CFNetwork 0x181890e70 0x0000000180c40e6f + 791 9 libdispatch.dylib 0x180cb2454 _dispatch_block_async_invoke2 + 147 10 libdispatch.dylib 0x180ca3670 _dispatch_client_callout + 19 11 libdispatch.dylib 0x180caadf4 _dispatch_lane_serial_drain + 671 12 libdispatch.dylib 0x180cab99c _dispatch_lane_invoke + 443 13 libdispatch.dylib 0x180cb61b8 _dispatch_workloop_worker_thread + 655 14 libsystem_pthread.dylib 0x1f23b30f4 _pthread_wqthread + 287 15 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 20: 0 libsystem_kernel.dylib 0x1b86ee1a4 _ulock_wait + 8 1 libdispatch.dylib 0x180ca3e08 _dispatch_thread_event_wait_slow + 55 2 libdispatch.dylib 0x180cb2bac _DISPATCH_WAIT_FOR_QUEUE__ + 363 3 libdispatch.dylib 0x180cb2754 _dispatch_sync_f_slow + 143 4 libsystem_trace.dylib 0x19b9b382c __os_state_request_for_self_block_invoke + 367 5 libdispatch.dylib 0x180ca1924 _dispatch_call_block_and_release + 31 6 libdispatch.dylib 0x180ca3670 _dispatch_client_callout + 19 7 libdispatch.dylib 0x180caadf4 _dispatch_lane_serial_drain + 671 8 libdispatch.dylib 0x180cab99c _dispatch_lane_invoke + 443 9 libdispatch.dylib 0x180cb61b8 _dispatch_workloop_worker_thread + 655 10 libsystem_pthread.dylib 0x1f23b30f4 _pthread_wqthread + 287 11 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 21: 0 libsystem_kernel.dylib 0x1b86ed504 mach_msg_trap + 8 1 CoreFoundation 0x180f9f738 _CFRunLoopServiceMachPort + 371 2 CoreFoundation 0x180fa3a2c _CFRunLoopRun + 1211 3 CoreFoundation 0x180fb7468 CFRunLoopRunSpecific + 599 4 CoreFoundation 0x181037b28 CFRunLoopRun + 63 5 CoreMotion 0x18e06abc4 0x000000018d41abc3 + 1203 6 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 7 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 22: 0 libsystem_kernel.dylib 0x1b86edb2c _workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 23: 0 libsystem_kernel.dylib 0x1b86edb2c _workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 24: 0 libsystem_kernel.dylib 0x1b86edae4 _semwait_signal + 8 1 libsystem_c.dylib 0x18bef5f3c $sleep + 47 2 Picnic 0x10064b354 0x10027c000 3 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 4 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 25: 0 libsystem_kernel.dylib 0x1b86ed504 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x1b86f9230 thread_suspend + 83 2 Picnic 0x100657b98 0x10027c000 3 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 4 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 26: 0 libsystem_kernel.dylib 0x1b86ed504 mach_msg_trap + 8 1 Picnic 0x100657bc4 0x10027c000 2 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 3 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 27: 0 libsystem_kernel.dylib 0x1b86ed504 mach_msg_trap + 8 1 CoreFoundation 0x180f9f738 _CFRunLoopServiceMachPort + 371 2 CoreFoundation 0x180fa3a2c _CFRunLoopRun + 1211 3 CoreFoundation 0x180fb7468 CFRunLoopRunSpecific + 599 4 Foundation 0x1827d5c84 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 235 5 Picnic 0x10058eab0 0x10027c000 6 Foundation 0x1828253fc _NSThread__start__ + 807 7 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 8 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 28: 0 libsystem_kernel.dylib 0x1b86ee1d0 _select + 8 1 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 2 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 29: 0 libsystem_kernel.dylib 0x1b86ed558 $semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x180ca4280 _dispatch_semaphore_wait_slow + 75 2 libdispatch.dylib 0x180cb4bb4 _dispatch_worker_thread + 311 3 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 4 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 30: 0 libsystem_kernel.dylib 0x1b86ed558 $semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x180ca4280 _dispatch_semaphore_wait_slow + 75 2 libdispatch.dylib 0x180cb4bb4 _dispatch_worker_thread + 311 3 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 4 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 31: 0 libsystem_kernel.dylib 0x1b86ed558 $semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x180ca4280 _dispatch_semaphore_wait_slow + 75 2 libdispatch.dylib 0x180cb4bb4 _dispatch_worker_thread + 311 3 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 4 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 32: 0 libsystem_kernel.dylib 0x1b86ed558 $semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x180ca4280 _dispatch_semaphore_wait_slow + 75 2 libdispatch.dylib 0x180cb4bb4 _dispatch_worker_thread + 311 3 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 4 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 33: 0 libsystem_kernel.dylib 0x1b86edb2c _workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 34 [Crashed]: 0 CoreFoundation 0x1810310fc _exceptionPreprocess + 220 1 libobjc.A.dylib 0x199881d64 objc_exception_throw + 59 2 Picnic 0x10053fcd8 0x10027c000 3 Picnic 0x1005be324 0x10027c000 4 Picnic 0x1005bec80 0x10027c000 5 CoreFoundation 0x180fba3a4 _invoking___ + 147 6 CoreFoundation 0x180fd7b74 -[NSInvocation invoke] + 467 7 CoreFoundation 0x18100e9d4 -[NSInvocation invokeWithTarget:] + 79 8 Picnic 0x100572ac4 0x10027c000 9 Picnic 0x1005750c8 0x10027c000 10 Picnic 0x100574cf8 0x10027c000 11 libdispatch.dylib 0x180ca1924 _dispatch_call_block_and_release + 31 12 libdispatch.dylib 0x180ca3670 _dispatch_client_callout + 19 13 libdispatch.dylib 0x180caadf4 _dispatch_lane_serial_drain + 671 14 libdispatch.dylib 0x180cab968 _dispatch_lane_invoke + 391 15 libdispatch.dylib 0x180cb61b8 _dispatch_workloop_worker_thread + 655 16 libsystem_pthread.dylib 0x1f23b30f4 _pthread_wqthread + 287 17 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 35: 0 CoreFoundation 0x180fbedc4 _CFStringEqual + 1296 1 CoreFoundation 0x181014274 _CFXNotificationRegistrarFindName + 103 2 CoreFoundation 0x180fb98a4 CFXNotificationRegistrarFind + 323 3 CoreFoundation 0x180fd8d90 _CFXNotificationPost + 615 4 Foundation 0x1827d7f58 -[NSNotificationCenter postNotificationName:object:userInfo:] + 95 5 CoreData 0x1886565bc -[NSManagedObjectContext _postContextDidSaveNotificationWithUserInfo:] + 2451 6 CoreData 0x18864aa78 -[NSManagedObjectContext _didSaveChanges] + 2883 7 CoreData 0x188626fc0 -[NSManagedObjectContext save:] + 3655 8 Instabug 0x102a92c60 _44-[IBGDALService writeASync:completionBlock:]_block_invoke_2 (IBGDALService.m:157) 9 CoreData 0x1886180b4 developerSubmittedBlockToNSManagedObjectContextPerform + 155 10 libdispatch.dylib 0x180ca3670 _dispatch_client_callout + 19 11 libdispatch.dylib 0x180caadf4 _dispatch_lane_serial_drain + 671 12 libdispatch.dylib 0x180cab968 _dispatch_lane_invoke + 391 13 libdispatch.dylib 0x180cb61b8 _dispatch_workloop_worker_thread + 655 14 libsystem_pthread.dylib 0x1f23b30f4 _pthread_wqthread + 287 15 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 36: 0 libsystem_pthread.dylib 0x1f23b2e8c $start_wqthread + 0 Thread 37: 0 libsystem_kernel.dylib 0x1b86edb2c _workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 38: 0 libsystem_kernel.dylib 0x1b86ed558 $semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x180ca4280 _dispatch_semaphore_wait_slow + 75 2 libdispatch.dylib 0x180cb4bb4 _dispatch_worker_thread + 311 3 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 4 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 39: 0 libsystem_kernel.dylib 0x1b86edb2c _workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Thread 40: 0 libsystem_kernel.dylib 0x1b86ed558 $semaphore_timedwait_trap + 8 1 libdispatch.dylib 0x180ca4280 _dispatch_semaphore_wait_slow + 75 2 libdispatch.dylib 0x180cb4bb4 _dispatch_worker_thread + 311 3 libsystem_pthread.dylib 0x1f23b39a4 _pthread_start + 147 4 libsystem_pthread.dylib 0x1f23b2ea0 thread_start + 7 Thread 41: 0 libsystem_kernel.dylib 0x1b86edb2c _workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1f23b2e94 $start_wqthread + 7 Binary Images: 0x1f23aa000 libsystem_platform.dylib arm64e 9472A9A5-9007-3C6D-849E-EC1A6890DBD1 0x192d1b000 libsystem_malloc.dylib arm64e 2829A9B6-35DA-3A4B-8672-777BDD140A00 0x180f98000 CoreFoundation arm64e E2F84645-2905-31EF-8EC7-3CC19C3CDDB3 0x1827bd000 Foundation arm64e 925A43CD-EAF2-3161-9378-3ED87468301D 0x102980000 Instabug arm64e CF19B18F-1C33-3A46-9337-F50D02C728A3 0x180c9f000 libdispatch.dylib arm64e BD02A625-8475-3FD6-8DC3-8AED25D1573B 0x19cb5a000 GraphicsServices arm64e B40E3B17-90C7-3EBC-B6BC-8C7B605F47A9 0x183441000 UIKitCore arm64e 920A0EE6-D266-3058-8144-27A27B23AD62 0x10027c000 Picnic arm64e E1370194-1AED-39B0-B0E8-7825F32FEB24 0x1b86ec000 libsystem_kernel.dylib arm64e FF3EE512-A0BC-3123-B983-D365A71FB06A 0x1f23b2000 libsystem_pthread.dylib arm64e A17D07CF-E86A-3923-87C4-921045898A8A 0x199912000 libc++.1.dylib arm64e 346A1FC1-F0B3-37DB-B102-09951BB9AA78 0x18bfb4000 JavaScriptCore arm64e 8882E299-ECD2-36A1-839B-41EE2CA83AA6 0x18a3cc000 AudioSession arm64e CFE93669-499D-3D2B-972B-0F516064A8A6 0x1817b3000 CFNetwork arm64e 23A465F1-E97C-36C5-A30F-CEFEC059F79F 0x19b9aa000 libsystem_trace.dylib arm64e 1FEB5451-1285-334A-80B1-284862EBEDB1 0x18e058000 CoreMotion arm64e F912B3A9-8488-3574-8F97-BC180643BC99 0x18bedd000 libsystem_c.dylib arm64e 9B299EE5-B379-3856-848B-524D82640DBC 0x19986c000 libobjc.A.dylib arm64e 56A134B6-C3D8-3D91-B1FC-7BDB75C5903B 0x1885f8000 CoreData arm64e FED0CA5D-3376-3DF3-B0FB-249917B12099 ```

I initially thought it might be related to the fact that we perform a bunch of work before we render the initial view (we called Instabug.start during the main componentDidMount as mentioned in the docs), but I have changed it to just calling it when the Instabug file is imported, so as soon as possible, ie. literally:

import Instabug from 'instabug-reactnative'

Instabug.start('x', [Instabug.invocationEvent.shake])
DavidMina96 commented 2 years ago

@lachenmayer Thanks for sharing this. Would it be possible to clarify how you call the startExecutionTrace API in your code or share with us a sample app that reproduces the issue? Appreciate your cooperation with us.

lachenmayer commented 2 years ago

Thanks @DavidMina96, apologies for the delay. I can't share our full app code with you, but we are initializing Instabug like this:

// Instabug.ts

export function initializeInstabug() {
  // See https://docs.instabug.com/docs/react-native-integration#same-build-for-beta-and-app-store
  // Instabug build scripts require the token to be a constant to be able to upload source maps.
  if (env.phase === 'production') {
    Instabug.start('prod token', [
      Instabug.invocationEvent.shake,
    ])
  } else {
    Instabug.start('staging token', [
      Instabug.invocationEvent.shake,
    ])
  }
  // Explicitly enable APM.
  APM.setEnabled(true)

  // Make setting an email address optional.
  BugReporting.setOptions([BugReporting.invocationOptions.emailFieldOptional])
}

We are calling it like this:

// main.ts

export function main() {
  initializeInstabug()

  const { App } = connectApp()

  AppRegistry.registerComponent('Picnic', () => App)
}

This main function is called from the top-level index.js file used as the entrypoint for our React Native app:

// index.js

// We also import some polyfills etc. here, this should definitely not affect Instabug...

import { main } from './main'
main()

connectApp initializes all of our app's business logic, including the module which creates the Query traces which are causing the crash. It should hopefully not be important what's in connectApp, I just wanted to highlight that we're definitely instantiating and enabling the Instabug module before we are instantiating any of our app's business logic, including the module which creates the Query traces which are causing the crash.

The module in question really does not do anything strange, it literally just calls:

// See https://github.com/Instabug/Instabug-React-Native/issues/684
const trace = (await APM.startExecutionTrace('Query')) as unknown as Promise<Instabug.Trace>
// ...sometime later...
trace.setAttribute('name', name)
// ...sometime later...
trace.end()

Unfortunately I can't share any further source code in public, but I'd be happy to give you access to our Instabug account with plenty of examples of this crash occurring? Or alternatively we could continue this conversation privately if you'd prefer.

DavidMina96 commented 2 years ago

@lachenmayer Thank you for providing these details. We'll further investigate this on our side and keep you posted.

DavidMina96 commented 2 years ago

Closing this issue as we proceeded with the discussion privately. Please feel free to reopen the issue if it still persists.

gsantiago commented 1 year ago

@lachenmayer how did you fix this? I'm facing the same problem