Crash on iOS SDK After Updating from version 4.1.0 to 6.0.1

Hello everyone,

I’m encountering a crash on Firebase Crashlytics after updating the SnowplowTracker SDK from version 4.1.0 to 6.0.1. Could anyone please offer any insights or potential solutions?

Crash Log:

Crashlytics - Stack trace

Application: omitted

Platform: apple

Version: 1.14.9 (202404011510)

Issue: 0c16beb6d281912128c416077f9d9a79

Session: a9403db0823e4090a5ecb66228048737_DNE_0_v2

Date: Tue Apr 09 2024 11:31:55 GMT-0400 (Eastern Daylight Time)

Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x9e88 __exceptionPreprocess
1 libobjc.A.dylib 0x178d8 objc_exception_throw
2 Foundation 0x2e670 _writeJSONValue
3 Foundation 0xc64b8 ___writeJSONObject_block_invoke
4 libswiftCore.dylib 0x37e9e4 specialized _SwiftDeferredNSDictionary.enumerateKeysAndObjects(options:using:)
5 libswiftCore.dylib 0xc9c38 @objc _SwiftDeferredNSDictionary.enumerateKeysAndObjects(options:using:)
6 Foundation 0x27f54 _writeJSONObject
7 Foundation 0xc64b8 ___writeJSONObject_block_invoke
8 libswiftCore.dylib 0x37e9e4 specialized _SwiftDeferredNSDictionary.enumerateKeysAndObjects(options:using:)
9 libswiftCore.dylib 0xc9c38 @objc _SwiftDeferredNSDictionary.enumerateKeysAndObjects(options:using:)
10 Foundation 0x27f54 _writeJSONObject
11 Foundation 0xd4cf8 ___writeJSONArray_block_invoke
12 CoreFoundation 0xa3a0 NSARRAY_IS_CALLING_OUT_TO_A_BLOCK
13 CoreFoundation 0x5ad0 __NSArrayEnumerate
14 Foundation 0xa9008 _writeJSONArray
15 Foundation 0xc64b8 ___writeJSONObject_block_invoke
16 libswiftCore.dylib 0x37e9e4 specialized _SwiftDeferredNSDictionary.enumerateKeysAndObjects(options:using:)
17 libswiftCore.dylib 0xc9c38 @objc _SwiftDeferredNSDictionary.enumerateKeysAndObjects(options:using:)
18 Foundation 0x27f54 writeJSONObject
19 Foundation 0x5166c -[NSJSONWriter dataWithRootObject:options:]
20 Foundation 0x51098 +[NSJSONSerialization dataWithJSONObject:options:error:]
21 SnowplowTracker 0xc0138 TrackerEvent.wrapContexts(to:base64Encoded:) + 158 (Payload.swift:158)
22 SnowplowTracker 0xac53c Tracker.payload(with:) + 472 (Tracker.swift:472)
23 SnowplowTracker 0xac0a4 Tracker.track(
:eventId:) + 450 (Tracker.swift:450)
24 SnowplowTracker 0xbb2c8 closure #1 in TrackerControllerIQWrapper.track(
:slight_smile: + 74 (TrackerControllerImpl.swift:74)
25 SnowplowTracker 0x1f320 thunk for @escaping @callee_guaranteed @Sendable () → () ()
26 libdispatch.dylib 0x24b4 _dispatch_call_block_and_release
27 libdispatch.dylib 0x3fdc _dispatch_client_callout
28 libdispatch.dylib 0xb694 _dispatch_lane_serial_drain
29 libdispatch.dylib 0xc1e0 _dispatch_lane_invoke
30 libdispatch.dylib 0x16e10 _dispatch_workloop_worker_thread
31 libsystem_pthread.dylib 0xdf8 _pthread_wqthread
32 libsystem_pthread.dylib 0xb98 start_wqthread

com.apple.main-thread
0 libsystem_kernel.dylib 0xb48 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x13008 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x13248 mach_msg_overwrite + 388
3 libsystem_kernel.dylib 0x108c mach_msg + 24
4 CoreFoundation 0x7aaf0 __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x7bd34 __CFRunLoopRun + 1232
6 CoreFoundation 0x80ed4 CFRunLoopRunSpecific + 612
7 GraphicsServices 0x1368 GSEventRunModal + 164
8 UIKitCore 0x3a23d0 -[UIApplication _run] + 888
9 UIKitCore 0x3a2034 UIApplicationMain + 340
10 shoppers-app 0x80c0 main + 6 (main.swift:6)
11 ??? 0x1c1cb8960 (Missing)

com.apple.CoreMotion.MotionThread
0 libsystem_kernel.dylib 0xb48 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x13008 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x13248 mach_msg_overwrite + 388
3 libsystem_kernel.dylib 0x108c mach_msg + 24
4 CoreFoundation 0x7aaf0 __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x7bd34 __CFRunLoopRun + 1232
6 CoreFoundation 0x80ed4 CFRunLoopRunSpecific + 612
7 CoreFoundation 0xc4d04 CFRunLoopRun + 64
8 CoreMotion 0x13ec0 CLMotionActivity::isTypeInVehicle(CLMotionActivity::Type) + 22820
9 libsystem_pthread.dylib 0x16cc _pthread_start + 148
10 libsystem_pthread.dylib 0xba4 thread_start + 8

com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0xb48 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x13008 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x13248 mach_msg_overwrite + 388
3 libsystem_kernel.dylib 0x108c mach_msg + 24
4 CoreFoundation 0x7aaf0 __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x7bd34 __CFRunLoopRun + 1232
6 CoreFoundation 0x80ed4 CFRunLoopRunSpecific + 612
7 Foundation 0x42334 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8 Foundation 0x4221c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64
9 UIKitCore 0x4d733c -[UIEventFetcher threadMain] + 436
10 Foundation 0x5b808 NSThread__start + 716
11 libsystem_pthread.dylib 0x16cc _pthread_start + 148
12 libsystem_pthread.dylib 0xba4 thread_start + 8

com.google.firebase.crashlytics.MachExceptionServer
0 libsystem_kernel.dylib 0xb48 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x13008 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x13248 mach_msg_overwrite + 388
3 libsystem_kernel.dylib 0x108c mach_msg + 24
4 FirebaseCrashlytics 0x171f4 FIRCLSMachExceptionServer + 192 (FIRCLSMachException.c:192)
5 libsystem_pthread.dylib 0x16cc _pthread_start + 148
6 libsystem_pthread.dylib 0xba4 thread_start + 8

Realm notification listener
0 libsystem_kernel.dylib 0x2480 kevent + 8
1 Realm 0x3f77c8 realm::_impl::ExternalCommitHelper::listen() + 156
2 Realm 0x3f7924 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct>, realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&, realm::RealmConfig const&)::$_0>>(void*) + 52
3 libsystem_pthread.dylib 0x16cc _pthread_start + 148
4 libsystem_pthread.dylib 0xba4 thread_start + 8

JavaScriptCore libpas scavenger
0 libsystem_kernel.dylib 0x141c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x806c _pthread_cond_wait + 1232
2 JavaScriptCore 0xf6324 scavenger_thread_main + 1164
3 libsystem_pthread.dylib 0x16cc _pthread_start + 148
4 libsystem_pthread.dylib 0xba4 thread_start + 8

com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0xb48 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x13008 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x13248 mach_msg_overwrite + 388
3 libsystem_kernel.dylib 0x108c mach_msg + 24
4 CoreFoundation 0x7aaf0 __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x7bd34 __CFRunLoopRun + 1232
6 CoreFoundation 0x80ed4 CFRunLoopRunSpecific + 612
7 CFNetwork 0x2565a8 _CFURLStorageSessionDisableCache + 61088
8 Foundation 0x5b808 NSThread__start + 716
9 libsystem_pthread.dylib 0x16cc _pthread_start + 148
10 libsystem_pthread.dylib 0xba4 thread_start + 8

GAIThread
0 libsystem_kernel.dylib 0xb48 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x13008 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x13248 mach_msg_overwrite + 388
3 libsystem_kernel.dylib 0x108c mach_msg + 24
4 CoreFoundation 0x7aaf0 __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x7bd34 __CFRunLoopRun + 1232
6 CoreFoundation 0x80ed4 CFRunLoopRunSpecific + 612
7 Foundation 0x42334 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8 Foundation 0x421c8 -[NSRunLoop(NSRunLoop) run] + 64
9 shoppers-app 0x94edf8 +[GAI threadMain:] + 64
10 Foundation 0x5b808 NSThread__start + 716
11 libsystem_pthread.dylib 0x16cc _pthread_start + 148
12 libsystem_pthread.dylib 0xba4 thread_start + 8

WebThread
0 libsystem_kernel.dylib 0xb48 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x13008 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x13248 mach_msg_overwrite + 388
3 libsystem_kernel.dylib 0x108c mach_msg + 24
4 CoreFoundation 0x7aaf0 __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x7bd34 __CFRunLoopRun + 1232
6 CoreFoundation 0x80ed4 CFRunLoopRunSpecific + 612
7 WebCore 0xbbcbe8 + 756
8 libsystem_pthread.dylib 0x16cc _pthread_start + 148
9 libsystem_pthread.dylib 0xba4 thread_start + 8

com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x16ac __select + 8
1 libsystem_kernel.dylib 0x16ac select$DARWIN_EXTSN + 8
2 CoreFoundation 0xcb6c4 __CFSocketManager + 636
3 libsystem_pthread.dylib 0x16cc _pthread_start + 148
4 libsystem_pthread.dylib 0xba4 thread_start + 8

com.google.fira.worker
0 libsystem_platform.dylib 0xc6c _platform_memset + 108
1 libsqlite3.dylib 0x2aad0 sqlite3_log + 2296
2 libsqlite3.dylib 0xc1aa4 sqlite3_sourceid + 47672
3 libsqlite3.dylib 0x2550c sqlite3_finalize + 7684
4 libsqlite3.dylib 0x45bb8 sqlite3_step + 6068
5 libsqlite3.dylib 0x44914 sqlite3_step + 1296
6 shoppers-app 0xa0e8d4 -[APMSqliteStore deleteRecordsFromTableWithName:condition:parameterValues:error:] + 284
7 shoppers-app 0x98096c -[APMDatabase deleteRawEventsOverAbsoluteLimit:] + 216
8 shoppers-app 0x9c1fe8 -[APMMeasurement(Event) writeEvent:isPublicEvent:isRealtime:] + 1232
9 shoppers-app 0x9bf56c __57-[APMMeasurement(Event) writeFilteredEventOnWorkerQueue:]_block_invoke + 604
10 shoppers-app 0xa0f1b8 -[APMSqliteStore performTransactionWithError:block:] + 176
11 shoppers-app 0x97ec60 -[APMDatabase performTransaction:] + 48
12 shoppers-app 0x9bf2e4 -[APMMeasurement(Event) writeFilteredEventOnWorkerQueue:] + 264
13 shoppers-app 0x9bef2c -[APMMeasurement(Event) writeEventOnWorkerQueue:] + 1444
14 shoppers-app 0x9be818 -[APMMeasurement(Event) handleEventOnWorkerQueue:] + 540
15 shoppers-app 0x9b297c -[APMMeasurement logEventOnWorkerQueue:notifyEventListeners:] + 76
16 shoppers-app 0x9b292c -[APMMeasurement logEventOnWorkerQueueWithOrigin:isPublicEvent:name:parameters:timestamp:enabled:ignoreEnabled:ignoreInterceptor:interceptor:addedScreenParameters:] + 708
17 shoppers-app 0x9b25c0 __151-[APMMeasurement logEventWithOrigin:isPublicEvent:name:parameters:timestamp:enabled:ignoreEnabled:ignoreInterceptor:interceptor:addedScreenParameters:]_block_invoke + 68
18 shoppers-app 0xa0486c __51-[APMScheduler scheduleOnWorkerQueueBlockID:block:]_block_invoke + 44
19 libdispatch.dylib 0x24b4 _dispatch_call_block_and_release + 32
20 libdispatch.dylib 0x3fdc _dispatch_client_callout + 20
21 libdispatch.dylib 0xb694 _dispatch_lane_serial_drain + 672
22 libdispatch.dylib 0xc1e0 _dispatch_lane_invoke + 384
23 libdispatch.dylib 0x16e10 _dispatch_workloop_worker_thread + 652
24 libsystem_pthread.dylib 0xdf8 _pthread_wqthread + 288
25 libsystem_pthread.dylib 0xb98 start_wqthread + 8

Crashed: com.google.firebase.crashlytics.ios.exception
0 FirebaseCrashlytics 0x1d6b8 FIRCLSProcessRecordAllThreads + 393 (FIRCLSProcess.c:393)
1 FirebaseCrashlytics 0x1da98 FIRCLSProcessRecordAllThreads + 424 (FIRCLSProcess.c:424)
2 FirebaseCrashlytics 0x14bb8 FIRCLSHandler + 34 (FIRCLSHandler.m:34)
3 FirebaseCrashlytics 0xf908 __FIRCLSExceptionRecord_block_invoke + 232 (FIRCLSException.mm:232)
4 libdispatch.dylib 0x3fdc _dispatch_client_callout + 20
5 libdispatch.dylib 0x13574 _dispatch_lane_barrier_sync_invoke_and_complete + 56
6 FirebaseCrashlytics 0xe940 FIRCLSExceptionRecord + 234 (FIRCLSException.mm:234)
7 FirebaseCrashlytics 0xf428 FIRCLSExceptionRecordNSException + 126 (FIRCLSException.mm:126)
8 FirebaseCrashlytics 0xe598 FIRCLSTerminateHandler() + 398 (FIRCLSException.mm:398)
9 libc++abi.dylib 0x10f28 std::__terminate(void (*)()) + 20
10 libc++abi.dylib 0x10ec4 std::terminate() + 56
11 libobjc.A.dylib 0x33bec objc_terminate + 16
12 libdispatch.dylib 0x3ff0 _dispatch_client_callout + 40
13 libdispatch.dylib 0xb694 _dispatch_lane_serial_drain + 672
14 libdispatch.dylib 0xc1e0 _dispatch_lane_invoke + 384
15 libdispatch.dylib 0x16e10 _dispatch_workloop_worker_thread + 652
16 libsystem_pthread.dylib 0xdf8 _pthread_wqthread + 288
17 libsystem_pthread.dylib 0xb98 start_wqthread + 8

Thread
0 libsystem_kernel.dylib 0x1050 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0xe44 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0xb98 start_wqthread + 8

Thread
0 libsystem_kernel.dylib 0x1050 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0xe44 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0xb98 start_wqthread + 8

Heap Helper Thread
0 libsystem_kernel.dylib 0x141c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x806c _pthread_cond_wait + 1232
2 JavaScriptCore 0x4c6a4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 1808
3 JavaScriptCore 0xd0fc bool WTF::Condition::waitUntilUncheckedWTF::Lock(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 304
4 JavaScriptCore 0xd578 WTF::Detail::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0, void>::call() + 248
5 JavaScriptCore 0x6ee5c WTF::thread::entryPoint(WTF::thread::NewThreadContext*) + 352
6 JavaScriptCore 0x710e4 WTF::wtfThreadEntryPoint(void*) + 16
7 libsystem_pthread.dylib 0x16cc _pthread_start + 148
8 libsystem_pthread.dylib 0xba4 thread_start + 8

Heap Helper Thread
0 libsystem_kernel.dylib 0x141c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x806c _pthread_cond_wait + 1232
2 JavaScriptCore 0x4c6a4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 1808
3 JavaScriptCore 0xd0fc bool WTF::Condition::waitUntilUncheckedWTF::Lock(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 304
4 JavaScriptCore 0xd578 WTF::Detail::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0, void>::call() + 248
5 JavaScriptCore 0x6ee5c WTF::thread::entryPoint(WTF::thread::NewThreadContext*) + 352
6 JavaScriptCore 0x710e4 WTF::wtfThreadEntryPoint(void*) + 16
7 libsystem_pthread.dylib 0x16cc _pthread_start + 148
8 libsystem_pthread.dylib 0xba4 thread_start + 8

Heap Helper Thread
0 libsystem_kernel.dylib 0x141c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x806c _pthread_cond_wait + 1232
2 JavaScriptCore 0x4c6a4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 1808
3 JavaScriptCore 0xd0fc bool WTF::Condition::waitUntilUncheckedWTF::Lock(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 304
4 JavaScriptCore 0xd578 WTF::Detail::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0, void>::call() + 248
5 JavaScriptCore 0x6ee5c WTF::thread::entryPoint(WTF::thread::NewThreadContext*) + 352
6 JavaScriptCore 0x710e4 WTF::wtfThreadEntryPoint(void*) + 16
7 libsystem_pthread.dylib 0x16cc _pthread_start + 148
8 libsystem_pthread.dylib 0xba4 thread_start + 8

Heap Helper Thread
0 libsystem_kernel.dylib 0x141c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x806c _pthread_cond_wait + 1232
2 JavaScriptCore 0x4c6a4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 1808
3 JavaScriptCore 0xd0fc bool WTF::Condition::waitUntilUncheckedWTF::Lock(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 304
4 JavaScriptCore 0xd578 WTF::Detail::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0, void>::call() + 248
5 JavaScriptCore 0x6ee5c WTF::thread::entryPoint(WTF::thread::NewThreadContext*) + 352
6 JavaScriptCore 0x710e4 WTF::wtfThreadEntryPoint(void*) + 16
7 libsystem_pthread.dylib 0x16cc _pthread_start + 148
8 libsystem_pthread.dylib 0xba4 thread_start + 8

Heap Helper Thread
0 libsystem_kernel.dylib 0x141c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x806c _pthread_cond_wait + 1232
2 JavaScriptCore 0x4c6a4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 1808
3 JavaScriptCore 0xd0fc bool WTF::Condition::waitUntilUncheckedWTF::Lock(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 304
4 JavaScriptCore 0xd578 WTF::Detail::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0, void>::call() + 248
5 JavaScriptCore 0x6ee5c WTF::thread::entryPoint(WTF::thread::NewThreadContext*) + 352
6 JavaScriptCore 0x710e4 WTF::wtfThreadEntryPoint(void*) + 16
7 libsystem_pthread.dylib 0x16cc _pthread_start + 148
8 libsystem_pthread.dylib 0xba4 thread_start + 8

Thread
0 libsystem_kernel.dylib 0x1050 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0xe44 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0xb98 start_wqthread + 8

Thread
0 libsystem_kernel.dylib 0x1050 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0xe44 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0xb98 start_wqthread + 8

Thread
0 libsystem_kernel.dylib 0x1050 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0xe44 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0xb98 start_wqthread + 8

Thread
0 libsystem_kernel.dylib 0x1050 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0xe44 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0xb98 start_wqthread + 8

Thread
0 libsystem_kernel.dylib 0x1050 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0xe44 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0xb98 start_wqthread + 8

Thread
0 libsystem_pthread.dylib 0xb90 start_wqthread + 254

Thread
0 libsystem_kernel.dylib 0x1050 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0xe44 _pthread_wqthread + 364
2 libsystem_pthread.dylib 0xb98 start_wqthread + 8

Hi @Love_Kumar,

This seems like a crash during JSON serialization of the context entities that are tracked with events (it happens at this line of code).

Is there any chance that the data you are passing to the context entities can’t be serialized to JSON?

Can you reproduce this error? How frequent is it in your crash reports?

1 Like