mixpanel/mixpanel-iphone

iOS 13 crashes on `[MixpanelExceptionHandler sharedHandler]`

allen-zeng opened this issue · 2 comments

Integration Method: CocoaPods
Xcode Version: 11
Library Version: 3.5.0
Platform: iOS
Language: Swift + Objective-C
Description:
We're seeing these crashes via the Xcode Organiser, but not in our own crash reporter (New Relic).
The number reported is an order of magnitude higher than any other crashes that are in the Organiser UI, with ~300 compared to 10s for all other crashes.
The crashes seem to be exclusively in iOS 13.

We had the same problem with an older version of the SDK as well, updating it didn't help.

Is it possible to prevent Mixpanel SDK from inserting itself as a crash handler?

Here is the crashed thread in a report:

Thread 11 name:
Thread 11 Crashed:
0   libsystem_platform.dylib      	0x000000018e9061a4 _os_unfair_lock_recursive_abort + 36 (lock.c:521)
1   libsystem_platform.dylib      	0x000000018e9040ac _os_unfair_lock_lock_slow + 304 (lock.c:566)
2   libobjc.A.dylib               	0x000000018e9265e0 lookUpImpOrForward + 128 (lock_private.h:661)
3   libobjc.A.dylib               	0x000000018e914400 _objc_msgSend_uncached + 64
4   nonprintable-path             	0x00000001052b8cf4 MPSignalHandler + 76 (MixpanelExceptionHandler.m:89)
5   libsystem_platform.dylib      	0x000000018e906434 _sigtramp + 60 (sigtramp.c:100)
6   libdyld.dylib                 	0x000000018e9f5a60 dyld3::closure::ObjCStringTable::getIndex(char const*) const + 56 (Closure.h:840)
7   libdyld.dylib                 	0x000000018e9f58d4 dyld3::closure::ObjCClassOpt::forEachClass(char const*, dyld3::Array<std::__1::pair<unsigned long... + 56 (Closure.cpp:1397)
8   libdyld.dylib                 	0x000000018ea02d48 dyld3::AllImages::forEachObjCClass(char const*, void (void*, bool, bool*) block_pointer) const + 140 (AllImages.cpp:1922)
9   libobjc.A.dylib               	0x000000018e933f98 getPreoptimizedClass + 164 (objc-opt.mm:279)
10  libobjc.A.dylib               	0x000000018e91eec0 getClassExceptSomeSwift(char const*) + 24 (objc-runtime-new.mm:1607)
11  libobjc.A.dylib               	0x000000018e91fd20 look_up_class + 96 (objc-runtime-new.mm:6843)
12  Foundation                    	0x000000018efcafac NSClassFromString + 204 (NSObjCRuntime.m:0)
13  BoardServices                 	0x0000000193a86b70 +[BSXPCServiceConnectionProxy invokeMethod:onTarget:withMessage:forConnection:] + 108 (BSXPCServiceConnectionProxy.m:329)
14  BoardServices                 	0x0000000193a85ccc -[BSXPCServiceConnectionProxy invokeMessage:onTarget:] + 148 (BSXPCServiceConnectionProxy.m:177)
15  BoardServices                 	0x0000000193a8d06c __63-[BSXPCServiceConnectionEventHandler connection:handleMessage:]_block_invoke + 436 (BSXPCServiceConnectionEventHandler.m:184)
16  BoardServices                 	0x0000000193aa3e20 BSXPCServiceConnectionExecuteCallOut + 352 (BSXPCServiceConnection.m:1049)
17  BoardServices                 	0x0000000193a8ce80 -[BSXPCServiceConnectionEventHandler connection:handleMessage:] + 184 (BSXPCServiceConnectionEventHandler.m:173)
18  BoardServices                 	0x0000000193aa259c -[BSXPCServiceConnection _connection_handleMessage:fromPeer:withHandoff:] + 648 (BSXPCServiceConnection.m:808)
19  libdispatch.dylib             	0x000000018e8a3bb0 _dispatch_call_block_and_release + 32 (init.c:1408)
20  libdispatch.dylib             	0x000000018e8a500c _dispatch_client_callout + 20 (object.m:495)
21  libdispatch.dylib             	0x000000018e8ab484 _dispatch_lane_serial_drain + 568 (inline_internal.h:2487)
22  libdispatch.dylib             	0x000000018e8abee8 _dispatch_lane_invoke + 424 (inline_internal.h:1854)
23  libdispatch.dylib             	0x000000018e8ab354 _dispatch_lane_serial_drain + 264 (inline_internal.h:2528)
24  libdispatch.dylib             	0x000000018e8abee8 _dispatch_lane_invoke + 424 (inline_internal.h:1854)
25  libdispatch.dylib             	0x000000018e8b4f20 _dispatch_workloop_worker_thread + 580 (queue.c:6386)
26  libsystem_pthread.dylib       	0x000000018e90aaa0 _pthread_wqthread + 280 (pthread.c:2323)
27  libsystem_pthread.dylib       	0x000000018e910c78 start_wqthread + 8

Expected Behavior:
Mixpanel SDK doesn't get in the way of crash reporting, or cause crashes itself.

hi @allen-zeng , thanks for bringing this up. I will take a look. In the meantime, you can turn the crash tracking off.

...
 @param trackCrashes    whether or not to track crashes in Mixpanel. may want to disable if you're seeing
 issues with your crash reporting for either signals or exceptions
...
+ (Mixpanel *)sharedInstanceWithToken:(NSString *)apiToken launchOptions:(nullable NSDictionary *)launchOptions 
trackCrashes:(BOOL)trackCrashes automaticPushTracking:(BOOL)automaticPushTracking;

We have released v3.9.0 which will no longer track crashes by default. In the future, we will consider deprecating the feature.