Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in [AMPTrackingOptions shouldTrackPlatform] when initializing Amplitude #498

Closed
terribleben opened this issue Jul 24, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@terribleben
Copy link

Expected Behavior

The app should launch without crashing.

Current Behavior

The app crashed while attempting to run Amplitude startNewSession: downstream of initializeApiKey: at boot time.

Here's a screenshot of what we're seeing:

image

Environment

  • SDK Version: 8.18.0
  • Device: Widespread across many iPhone models in our production app; the above Xcode screenshot shows iPhone SE (3rd gen)
  • OS Version: Widespread across many versions of iOS in our production app; the above Xcode screenshot is on a device running iOS 17

More info

We see about 15 occurrences of this crash per 24h period in our production app. Here are the Sentry analytics about the distribution of the crash:

image

Full stack trace

(lldb) bt
* thread #9, queue = 'BACKGROUND (QOS: UNSPECIFIED)', stop reason = EXC_BAD_ACCESS (code=1, address=0x294deef18d90)
    frame #0: 0x000000019bccf020 libobjc.A.dylib`objc_msgSend + 32
    frame #1: 0x000000010454cee8 Castle`-[AMPTrackingOptions shouldTrackPlatform](self=0x0000000300b68d80, _cmd="shouldTrackPlatform") at AMPTrackingOptions.m:183:12
    frame #2: 0x0000000104542ecc Castle`-[Amplitude annotateEvent:](self=0x000000012d41b2d0, _cmd="annotateEvent:", event=10 key/value pairs) at Amplitude.m:783:9
    frame #3: 0x00000001045421ac Castle`__157-[Amplitude logEvent:withEventProperties:withApiProperties:withUserProperties:withGroups:withGroupProperties:withTimestamp:outOfSession:withMiddlewareExtra:]_block_invoke(.block_descriptor=0x000000016bee2888) at Amplitude.m:708:9
    frame #4: 0x0000000104540c9c Castle`-[Amplitude runOnBackgroundQueue:](self=0x000000012d41b2d0, _cmd="runOnBackgroundQueue:", block=0x0000000104541c48) at Amplitude.m:593:9
    frame #5: 0x0000000104541b5c Castle`-[Amplitude logEvent:withEventProperties:withApiProperties:withUserProperties:withGroups:withGroupProperties:withTimestamp:outOfSession:withMiddlewareExtra:](self=0x000000012d41b2d0, _cmd="logEvent:withEventProperties:withApiProperties:withUserProperties:withGroups:withGroupProperties:withTimestamp:outOfSession:withMiddlewareExtra:", eventType=@"session_start", eventProperties=0x0000000000000000, apiProperties=1 key/value pair, userProperties=0x0000000000000000, groups=0x0000000000000000, groupProperties=0x0000000000000000, timestamp=(long)1721837864803, outOfSession=NO, extra=0x0000000000000000) at Amplitude.m:685:5
    frame #6: 0x00000001045416a4 Castle`-[Amplitude logEvent:withEventProperties:withApiProperties:withUserProperties:withGroups:withGroupProperties:withTimestamp:outOfSession:](self=0x000000012d41b2d0, _cmd="logEvent:withEventProperties:withApiProperties:withUserProperties:withGroups:withGroupProperties:withTimestamp:outOfSession:", eventType=@"session_start", eventProperties=0x0000000000000000, apiProperties=1 key/value pair, userProperties=0x0000000000000000, groups=0x0000000000000000, groupProperties=0x0000000000000000, timestamp=(long)1721837864803, outOfSession=NO) at Amplitude.m:655:5
    frame #7: 0x00000001045468e0 Castle`-[Amplitude sendSessionEvent:](self=0x000000012d41b2d0, _cmd="sendSessionEvent:", sessionEvent=@"session_start") at Amplitude.m:1350:5
    frame #8: 0x00000001045467a0 Castle`-[Amplitude startNewSession:](self=0x000000012d41b2d0, _cmd="startNewSession:", timestamp=(long)1721837864803) at Amplitude.m:1333:9
    frame #9: 0x00000001045464a8 Castle`-[Amplitude startOrContinueSessionNSNumber:inForeground:](self=0x000000012d41b2d0, _cmd="startOrContinueSessionNSNumber:inForeground:", timestamp=(long)1721837864803, inForeground=NO) at Amplitude.m:1295:13
  * frame #10: 0x0000000104540bec Castle`__30-[Amplitude checkInForeground]_block_invoke_2(.block_descriptor=0x00000003007cd710) at Amplitude.m:575:21
    frame #11: 0x00000001a2c75be0 Foundation`__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 24
    frame #12: 0x00000001a2c75aa0 Foundation`-[NSBlockOperation main] + 104
    frame #13: 0x00000001a2c758a0 Foundation`__NSOPERATION_IS_INVOKING_MAIN__ + 16
    frame #14: 0x00000001a2c73b40 Foundation`-[NSOperation start] + 648
    frame #15: 0x00000001a2cf8558 Foundation`__NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 16
    frame #16: 0x00000001a2cf81a4 Foundation`__NSOQSchedule_f + 172
    frame #17: 0x000000010dfcb764 libdispatch.dylib`_dispatch_block_async_invoke2 + 148
    frame #18: 0x000000010dfba7bc libdispatch.dylib`_dispatch_client_callout + 20
    frame #19: 0x000000010dfbd8e0 libdispatch.dylib`_dispatch_continuation_pop + 676
    frame #20: 0x000000010dfbcbb8 libdispatch.dylib`_dispatch_async_redirect_invoke + 680
    frame #21: 0x000000010dfceae4 libdispatch.dylib`_dispatch_root_queue_drain + 404
    frame #22: 0x000000010dfcf4d8 libdispatch.dylib`_dispatch_worker_thread2 + 188
    frame #23: 0x0000000200c878f8 libsystem_pthread.dylib`_pthread_wqthread + 228```
@terribleben terribleben added the bug Something isn't working label Jul 24, 2024
@crleona
Copy link
Collaborator

crleona commented Jul 24, 2024

Hi @terribleben I'm wondering if this may be a concurrent access issue on AMPTrackingOptions - are you able to share a full stack trace (all threads) or just any other threads which are accessing the Amplitude object at the same time?

@terribleben
Copy link
Author

Sure thing - I pulled out an example from our Sentry logs. It contains startNewSession and annotateEvent after booting the app, but the exact trace below that differs slightly from the one I reported this morning.

Thanks for your response!

OS Version: iOS 15.8.2 (19H384)
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: SEGV_NOOP at 0x000000025d4002e0
Crashed Thread: 6

Application Specific Information:
dyld_v1   arm64 > shouldTrackField: >
KERN_INVALID_ADDRESS at 0x25d4002e0.

Thread 6 Crashed:
0   libobjc.A.dylib                 0x32fcdfcf4         objc_msgSend
1   Castle                          0x202ada17c         -[Amplitude annotateEvent:] (Amplitude.m:828)
2   Castle                          0x202ad9638         __157-[Amplitude logEvent:withEventProperties:withApiProperties:withUserProperties:withGroups:withGroupProperties:withTimestamp:outOfSession:withMiddlewareExtra:]_block_invoke (Amplitude.m:708)
3   Castle                          0x202ad8c4c         -[Amplitude runOnBackgroundQueue:] (Amplitude.m:593)
4   Castle                          0x202ad91b8         -[Amplitude logEvent:withEventProperties:withApiProperties:withUserProperties:withGroups:withGroupProperties:withTimestamp:outOfSession:withMiddlewareExtra:] (Amplitude.m:685)
5   Castle                          0x202ad8f0c         -[Amplitude logEvent:withEventProperties:withApiProperties:withUserProperties:withGroups:withGroupProperties:withTimestamp:outOfSession:] (Amplitude.m:655)
6   Castle                          0x202adc0b0         -[Amplitude sendSessionEvent:] (Amplitude.m:1350)
7   Castle                          0x202adbf94         -[Amplitude startNewSession:] (Amplitude.m:1328)
8   Castle                          0x202adbebc         -[Amplitude startOrContinueSessionNSNumber:inForeground:]
9   Castle                          0x202ad8bb8         __30-[Amplitude checkInForeground]_block_invoke_2 (Amplitude.m:575)
10  Foundation                      0x3039f6398         __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
11  Foundation                      0x303a07a6c         -[NSBlockOperation main]
12  Foundation                      0x3039e1a88         __NSOPERATION_IS_INVOKING_MAIN__
13  Foundation                      0x3039f1fc8         -[NSOperation start]
14  Foundation                      0x3039f5494         __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__
15  Foundation                      0x303a02cc8         __NSOQSchedule_f
16  libdispatch.dylib               0x300571540         _dispatch_block_async_invoke2
17  libdispatch.dylib               0x3005c4090         _dispatch_client_callout
18  libdispatch.dylib               0x300566bb4         _dispatch_continuation_pop$VARIANT$mp
19  libdispatch.dylib               0x3005662dc         _dispatch_async_redirect_invoke
20  libdispatch.dylib               0x300573b90         _dispatch_root_queue_drain
21  libdispatch.dylib               0x300574398         _dispatch_worker_thread2
22  libsystem_pthread.dylib         0x3b7397dc0         _pthread_wqthread

Thread 0
0   libsystem_kernel.dylib          0x375e62aac         mach_msg_trap
1   libsystem_kernel.dylib          0x375e63078         mach_msg
2   CoreFoundation                  0x300b88c84         __CFRunLoopServiceMachPort
3   CoreFoundation                  0x300b8cf8c         __CFRunLoopRun
4   CoreFoundation                  0x300ba0170         CFRunLoopRunSpecific
5   GraphicsServices                0x34223b984         GSEventRunModal
6   UIKitCore                       0x3056dda84         -[UIApplication _run]
7   UIKitCore                       0x305476f74         UIApplicationMain
8   Castle                          0x20333e70c         main
9   <unknown>                       0x10412c4d0         <redacted>

Thread 1
0   libsystem_kernel.dylib          0x375e62aac         mach_msg_trap
1   libsystem_kernel.dylib          0x375e63078         mach_msg
2   libdispatch.dylib               0x30057af78         _dispatch_mach_send_and_wait_for_reply
3   libdispatch.dylib               0x30057b308         dispatch_mach_send_with_result_and_wait_for_reply$VARIANT$mp
4   libxpc.dylib                    0x3b73e09b8         xpc_connection_send_message_with_reply_sync
5   Foundation                      0x3039e5160         __NSXPCCONNECTION_IS_WAITING_FOR_A_SYNCHRONOUS_REPLY__
6   Foundation                      0x3039eabac         -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]
7   CoreFoundation                  0x300bae234         ___forwarding___
8   CoreFoundation                  0x300bad758         __forwarding_prep_0___
9   CoreServices                    0x30148c96c         -[LSApplicationWorkspace deviceIdentifierForAdvertising]
10  AdSupport                       0x37ea75c10         -[ASIdentifierManager advertisingIdentifier]
11  Castle                          0x202acfe20         +[ADJUtil idfa] (ADJUtil.m:1057)
12  Castle                          0x202abbca0         +[ADJPackageBuilder addIdfaToParameters:withConfig:logger:] (ADJPackageBuilder.m:1388)
13  Castle                          0x202abb19c         -[ADJPackageBuilder addIdfaIfPossibleToParameters:] (ADJPackageBuilder.m:1239)
14  Castle                          0x202ab897c         -[ADJPackageBuilder getThirdPartySharingParameters:] (ADJPackageBuilder.m:971)
15  Castle                          0x202ab1b74         -[ADJPackageBuilder buildThirdPartySharingPackage:] (ADJPackageBuilder.m:188)
16  Castle                          0x202aa0c28         -[ADJActivityHandler trackThirdPartySharingI:thirdPartySharing:] (ADJActivityHandler.m:1326)
17  Castle                          0x202a9d484         __45-[ADJActivityHandler trackThirdPartySharing:]_block_invoke (ADJActivityHandler.m:598)
18  Castle                          0x202acf03c         __42+[ADJUtil launchInQueue:selfInject:block:]_block_invoke (ADJUtil.m:803)
19  libdispatch.dylib               0x3005c3090         _dispatch_call_block_and_release
20  libdispatch.dylib               0x3005c4090         _dispatch_client_callout
21  libdispatch.dylib               0x30056a738         _dispatch_lane_serial_drain$VARIANT$mp
22  libdispatch.dylib               0x30056b1f0         _dispatch_lane_invoke$VARIANT$mp
23  libdispatch.dylib               0x300574ec4         _dispatch_workloop_worker_thread
24  libsystem_pthread.dylib         0x3b7397dfc         _pthread_wqthread

Thread 2
0   libsystem_kernel.dylib          0x375e63688         __ulock_wait
1   libsystem_platform.dylib        0x3b737d760         _os_unfair_lock_lock_slow
2   libobjc.A.dylib                 0x32fcf26d8         protocol_copyProtocolList
3   CoreTelephony                   0x30191cbf8         _ZZN8dispatch5asyncIZ44-[CoreTelephonyClientMux addDelegate:queue:]E3$_0EEvP16dispatch_queue_sNSt3__110unique_ptrIT_NS4_14default_deleteIS6_EEEEENUlPvE_8__invokeESA_
4   libdispatch.dylib               0x3005c4090         _dispatch_client_callout
5   libdispatch.dylib               0x30056a738         _dispatch_lane_serial_drain$VARIANT$mp
6   libdispatch.dylib               0x30056b220         _dispatch_lane_invoke$VARIANT$mp
7   libdispatch.dylib               0x300574ec4         _dispatch_workloop_worker_thread
8   libsystem_pthread.dylib         0x3b7397dfc         _pthread_wqthread

Thread 3
0   libsystem_kernel.dylib          0x375e63014         __workq_kernreturn
1   libsystem_pthread.dylib         0x3b7397e48         _pthread_wqthread

Thread 4 name: com.apple.uikit.eventfetch-thread
0   libsystem_kernel.dylib          0x375e62aac         mach_msg_trap
1   libsystem_kernel.dylib          0x375e63078         mach_msg
2   CoreFoundation                  0x300b88c84         __CFRunLoopServiceMachPort
3   CoreFoundation                  0x300b8cf8c         __CFRunLoopRun
4   CoreFoundation                  0x300ba0170         CFRunLoopRunSpecific
5   Foundation                      0x3039bfea8         -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
6   Foundation                      0x3039fefcc         -[NSRunLoop(NSRunLoop) runUntilDate:]
7   UIKitCore                       0x30565cef0         -[UIEventFetcher threadMain]
8   Foundation                      0x303a0cbd8         __NSThread__start__
9   libsystem_pthread.dylib         0x3b7399334         _pthread_start

Thread 5
0   libsystem_kernel.dylib          0x375e6330c         __bsdthread_ctl
1   libsystem_pthread.dylib         0x3b73980f8         _pthread_set_properties_self
2   libdispatch.dylib               0x300565e3c         _dispatch_set_priority_and_mach_voucher_slow$VARIANT$mp
3   libdispatch.dylib               0x300565fe0         _dispatch_set_priority_and_voucher_slow$VARIANT$mp
4   libdispatch.dylib               0x300566c78         _dispatch_continuation_pop$VARIANT$mp
5   libdispatch.dylib               0x30057928c         _dispatch_source_cancel_callout
6   libdispatch.dylib               0x300578744         _dispatch_source_invoke$VARIANT$mp
7   libdispatch.dylib               0x30056c394         _dispatch_workloop_invoke$VARIANT$mp
8   libdispatch.dylib               0x300574ec4         _dispatch_workloop_worker_thread
9   libsystem_pthread.dylib         0x3b7397dfc         _pthread_wqthread

Thread 6 Crashed:
0   libobjc.A.dylib                 0x32fcdfcf4         objc_msgSend
1   Castle                          0x202ada17c         -[Amplitude annotateEvent:] (Amplitude.m:828)
2   Castle                          0x202ad9638         __157-[Amplitude logEvent:withEventProperties:withApiProperties:withUserProperties:withGroups:withGroupProperties:withTimestamp:outOfSession:withMiddlewareExtra:]_block_invoke (Amplitude.m:708)
3   Castle                          0x202ad8c4c         -[Amplitude runOnBackgroundQueue:] (Amplitude.m:593)
4   Castle                          0x202ad91b8         -[Amplitude logEvent:withEventProperties:withApiProperties:withUserProperties:withGroups:withGroupProperties:withTimestamp:outOfSession:withMiddlewareExtra:] (Amplitude.m:685)
5   Castle                          0x202ad8f0c         -[Amplitude logEvent:withEventProperties:withApiProperties:withUserProperties:withGroups:withGroupProperties:withTimestamp:outOfSession:] (Amplitude.m:655)
6   Castle                          0x202adc0b0         -[Amplitude sendSessionEvent:] (Amplitude.m:1350)
7   Castle                          0x202adbf94         -[Amplitude startNewSession:] (Amplitude.m:1328)
8   Castle                          0x202adbebc         -[Amplitude startOrContinueSessionNSNumber:inForeground:]
9   Castle                          0x202ad8bb8         __30-[Amplitude checkInForeground]_block_invoke_2 (Amplitude.m:575)
10  Foundation                      0x3039f6398         __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
11  Foundation                      0x303a07a6c         -[NSBlockOperation main]
12  Foundation                      0x3039e1a88         __NSOPERATION_IS_INVOKING_MAIN__
13  Foundation                      0x3039f1fc8         -[NSOperation start]
14  Foundation                      0x3039f5494         __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__
15  Foundation                      0x303a02cc8         __NSOQSchedule_f
16  libdispatch.dylib               0x300571540         _dispatch_block_async_invoke2
17  libdispatch.dylib               0x3005c4090         _dispatch_client_callout
18  libdispatch.dylib               0x300566bb4         _dispatch_continuation_pop$VARIANT$mp
19  libdispatch.dylib               0x3005662dc         _dispatch_async_redirect_invoke
20  libdispatch.dylib               0x300573b90         _dispatch_root_queue_drain
21  libdispatch.dylib               0x300574398         _dispatch_worker_thread2
22  libsystem_pthread.dylib         0x3b7397dc0         _pthread_wqthread

Thread 7
0   libsystem_kernel.dylib          0x375e63014         __workq_kernreturn
1   libsystem_pthread.dylib         0x3b7397e48         _pthread_wqthread

Thread 8
0   libsystem_pthread.dylib         0x3b7397924         start_wqthread

Thread 9 name: com.facebook.react.JavaScript
0   libsystem_kernel.dylib          0x375e62bcc         syscall_thread_switch
1   JavaScriptCore                  0x3165edf40         JSC::Heap::resumeThePeriphery
2   JavaScriptCore                  0x3165e7be8         JSC::Heap::finishChangingPhase
3   JavaScriptCore                  0x3165eb078         JSC::Heap::runEndPhase
4   JavaScriptCore                  0x3165e7a28         JSC::Heap::runCurrentPhase
5   JavaScriptCore                  0x3165fcc44         WTF::ScopedLambdaFunctor<T>::implFunction
6   JavaScriptCore                  0x3166113fc         JSC::callWithCurrentThreadState
7   JavaScriptCore                  0x3165eee28         JSC::Heap::collectInMutatorThread
8   JavaScriptCore                  0x3165ee890         JSC::Heap::stopIfNecessarySlow
9   JavaScriptCore                  0x3165e4a08         JSC::Heap::collectIfNecessaryOrDefer
10  JavaScriptCore                  0x316bd1510         JSC::Structure::materializePropertyTable
11  JavaScriptCore                  0x316825738         JSC::LLInt::performLLIntGetByID
12  JavaScriptCore                  0x316825424         llint_slow_path_get_by_id
13  JavaScriptCore                  0x315f8f7f8         llint_entry
14  JavaScriptCore                  0x315fa8f34         [inlined] llint_entry
15  JavaScriptCore                  0x315fa8f34         [inlined] llint_entry
16  JavaScriptCore                  0x315fa8f34         [inlined] llint_entry
17  JavaScriptCore                  0x315fa8f34         [inlined] llint_entry
18  JavaScriptCore                  0x315fa8f34         [inlined] llint_entry
19  JavaScriptCore                  0x315fa8f34         [inlined] llint_entry
20  JavaScriptCore                  0x315fa8f34         [inlined] llint_entry
21  JavaScriptCore                  0x315fa8f34         llint_entry
22  JavaScriptCore                  0x315faa200         llint_entry
23  JavaScriptCore                  0x315fa8e9c         llint_entry
24  JavaScriptCore                  0x315fa8f34         llint_entry
25  JavaScriptCore                  0x315fa8e9c         llint_entry
26  JavaScriptCore                  0x315f83c78         vmEntryToJavaScript
27  JavaScriptCore                  0x316716814         JSC::Interpreter::executeCall
28  JavaScriptCore                  0x316a31db4         JSC::boundThisNoArgsFunctionCall
29  JavaScriptCore                  0x315f83e24         vmEntryToNative
30  JavaScriptCore                  0x316716868         JSC::Interpreter::executeCall
31  JavaScriptCore                  0x31602c16c         JSObjectCallAsFunction
32  Castle                          0x202c6cf34         facebook::jsc::JSCRuntime::call (JSCRuntime.cpp:1342)
33  Castle                          0x202c792a0         [inlined] facebook::jsi::Function::call (jsi-inl.h:259)
34  Castle                          0x202c792a0         [inlined] facebook::jsi::Function::call (jsi-inl.h:264)
35  Castle                          0x202c792a0         facebook::jsi::Function::call<T> (jsi-inl.h:272)
36  Castle                          0x202c7910c         [inlined] facebook::react::JSIExecutor::callFunction::lambda::operator() (JSIExecutor.cpp:253)
37  Castle                          0x202c7910c         [inlined] std::__1::__invoke[abi:ue170006]<T> (invoke.h:340)
38  Castle                          0x202c7910c         [inlined] std::__1::__invoke_void_return_wrapper<T>::__call[abi:ue170006]<T> (invoke.h:415)
39  Castle                          0x202c7910c         [inlined] std::__1::__function::__alloc_func<T>::operator()[abi:ue170006] (function.h:193)
40  Castle                          0x202c7910c         std::__1::__function::__func<T>::operator() (function.h:364)
41  Castle                          0x202ba0418         [inlined] std::__1::__invoke[abi:ue170006]<T> (invoke.h:340)
42  Castle                          0x202ba0418         std::__1::__invoke_void_return_wrapper<T>::__call[abi:ue170006]<T> (invoke.h:415)
43  Castle                          0x202c760ec         [inlined] std::__1::__function::__value_func<T>::operator()[abi:ue170006] (function.h:518)
44  Castle                          0x202c760ec         [inlined] std::__1::function<T>::operator() (function.h:1169)
45  Castle                          0x202c760ec         facebook::react::JSIExecutor::callFunction (JSIExecutor.cpp:251)
46  Castle                          0x202c69584         [inlined] std::__1::__function::__value_func<T>::operator()[abi:ue170006] (function.h:518)
47  Castle                          0x202c69584         [inlined] std::__1::function<T>::operator() (function.h:1169)
48  Castle                          0x202c69584         [inlined] facebook::react::NativeToJsBridge::runOnExecutorQueue::lambda::operator() (NativeToJsBridge.cpp:310)
49  Castle                          0x202c69584         [inlined] std::__1::__invoke[abi:ue170006]<T> (invoke.h:340)
50  Castle                          0x202c69584         [inlined] std::__1::__invoke_void_return_wrapper<T>::__call[abi:ue170006]<T> (invoke.h:415)
51  Castle                          0x202c69584         [inlined] std::__1::__function::__alloc_func<T>::operator()[abi:ue170006] (function.h:193)
52  Castle                          0x202c69584         std::__1::__function::__func<T>::operator() (function.h:364)
53  Castle                          0x202bbd988         [inlined] std::__1::__function::__value_func<T>::operator()[abi:ue170006] (function.h:518)
54  Castle                          0x202bbd988         [inlined] std::__1::function<T>::operator() (function.h:1169)
55  Castle                          0x202bbd988         facebook::react::tryAndReturnError (RCTCxxUtils.mm:74)
56  Castle                          0x202bc8a04         facebook::react::RCTMessageThread::tryFunc (RCTMessageThread.mm:69)
57  Castle                          0x202bc87d0         [inlined] std::__1::__function::__value_func<T>::operator()[abi:ue170006] (function.h:518)
58  Castle                          0x202bc87d0         [inlined] std::__1::function<T>::operator() (function.h:1169)
59  Castle                          0x202bc87d0         facebook::react::RCTMessageThread::runAsync (RCTMessageThread.mm:45)
60  CoreFoundation                  0x300bef688         __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__
61  CoreFoundation                  0x300bf04ac         __CFRunLoopDoBlocks
62  CoreFoundation                  0x300b8ce18         __CFRunLoopRun
63  CoreFoundation                  0x300ba0170         CFRunLoopRunSpecific
64  Castle                          0x202bb3284         +[RCTCxxBridge runRunLoop] (RCTCxxBridge.mm:337)
65  Foundation                      0x303a0cbd8         __NSThread__start__
66  libsystem_pthread.dylib         0x3b7399334         _pthread_start

Thread 10 name: JavaScriptCore libpas scavenger
0   libsystem_kernel.dylib          0x375e63484         __psynch_cvwait
1   libsystem_pthread.dylib         0x3b739fbc0         _pthread_cond_wait$VARIANT$mp
2   JavaScriptCore                  0x315cc50c4         scavenger_thread_main
3   libsystem_pthread.dylib         0x3b7399334         _pthread_start

Thread 11
0   libsystem_kernel.dylib          0x375e63014         __workq_kernreturn
1   libsystem_pthread.dylib         0x3b7397e48         _pthread_wqthread

Thread 12 name: Heap Helper Thread
0   libsystem_kernel.dylib          0x375e63484         __psynch_cvwait
1   libsystem_pthread.dylib         0x3b739fbc0         _pthread_cond_wait$VARIANT$mp
2   JavaScriptCore                  0x315c298a0         WTF::ParkingLot::parkConditionallyImpl
3   JavaScriptCore                  0x315bf1728         WTF::Condition::waitUntilUnchecked<T>
4   JavaScriptCore                  0x315bf1b78         WTF::Detail::CallableWrapper<T>::call
5   JavaScriptCore                  0x315c49910         WTF::Thread::entryPoint
6   JavaScriptCore                  0x315c4bbe8         WTF::wtfThreadEntryPoint
7   libsystem_pthread.dylib         0x3b7399334         _pthread_start

Thread 13
0   libsystem_kernel.dylib          0x375e62fd0         __semwait_signal
1   libsystem_c.dylib               0x315a46a3c         nanosleep
2   libsystem_c.dylib               0x315a5a70c         sleep
3   Castle                          0x202cc8bb0         monitorCachedData (SentryCrashCachedData.c:145)
4   libsystem_pthread.dylib         0x3b7399334         _pthread_start

Thread 14
0   libsystem_kernel.dylib          0x375e62aac         mach_msg_trap
1   libsystem_kernel.dylib          0x375e63078         mach_msg
2   Castle                          0x202cd48d8         handleExceptions (SentryCrashMonitor_MachException.c:314)
3   libsystem_pthread.dylib         0x3b7399334         _pthread_start

Thread 16
0   libsystem_kernel.dylib          0x375e62fd0         __semwait_signal
1   libsystem_c.dylib               0x315a46a3c         nanosleep
2   Foundation                      0x303a1e97c         +[NSThread sleepForTimeInterval:]
3   Castle                          0x202cb7960         -[SentryANRTracker detectANRs] (SentryANRTracker.m:105)
4   Foundation                      0x303a0cbd8         __NSThread__start__
5   libsystem_pthread.dylib         0x3b7399334         _pthread_start

Thread 6 crashed with ARM Thread State (64-bit):
    x0: 0x0000000280a102d0   x1: 0x000000010377a6ad   x2: 0x0000000103844490   x3: 0x00000001038489d0
    x4: 0x0000000000000330   x5: 0x0000000147e47eb0   x6: 0x000000000000003d   x7: 0x0000000000000023
    x8: 0x00000001037d5000   x9: 0x0000000000003902  x10: 0x0000000000000002  x11: 0x000000028340c928
   x12: 0x0000000000000002  x13: 0x0000bb125d4002d0  x14: 0x00000001804c0000  x15: 0x000000025d4002d0
   x16: 0x000000025d4002d0  x17: 0x0000000102adf47c  x18: 0x0000000000000000  x19: 0x0000000280858f60
   x20: 0x0000000147e44200  x21: 0x0000000281d3bac0  x22: 0x0000000280858640  x23: 0x0000000280620e10
   x24: 0xb58e2fee6a8c3a7c  x25: 0xb58e2fee6a8c3a7c  x26: 0x0000000000000000  x27: 0x000000010390b000
   x28: 0x0000000000000000   fp: 0x000000016d6fa900   lr: 0x0000000102ada180   sp: 0x000000016d6fa890
    pc: 0x00000001980d0cf4 cpsr: 0x0000000020000000

@crleona
Copy link
Collaborator

crleona commented Jul 25, 2024

Thanks! It does not appear to be a threading issue as Amplitude is only accessed on thread 6. Please let me know if you have any additional information about how to reproduce the issue, otherwise I'll continue to look on my end.

@crleona
Copy link
Collaborator

crleona commented Jul 25, 2024

Could you please see if #499 fixes the crash?

@terribleben
Copy link
Author

Sounds good - I'll patch in this change. Since the crash doesn't repro reliably, I can't give a fast/firm answer unless I happen to catch it. The change looks relatively safe, so we can try releasing to a small percent of our users and see if it still shows up; but it might be several days before I can do a production release. Will let you know!

@crleona
Copy link
Collaborator

crleona commented Jul 26, 2024

Thanks @terribleben - we'll get this merged into main but I'll wait to hear back from you before releasing.

@terribleben
Copy link
Author

Can confirm that we're no longer seeing this issue in production after patching the fix. Thanks!

@crleona
Copy link
Collaborator

crleona commented Aug 5, 2024

This should be released in 8.19.3

@crleona crleona closed this as completed Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants