Closed igled7 closed 3 years ago
hi @igled7 , could you try v2.8.3? We have a number of fixes along the way since v2.7.7.
Thanks @zihejia!
I can upgrade to version 2.8.3.
@zihejia all the crashes coming from Mixpanel happen on archive in the method Persistence.archiveProperties(_:token:)
.
Most of them happen when the callback FlushDelegate.updateQueue(_:type:)
triggers the archive. I wonder if there is any kind of race condition and the properties are mutated somehow while the serialization is done.
As I mentioned above, Mixpanel SDK started to crash after upgrading to 2.7.7 from 2.7.0. Could you confirm if these issues have been addressed in 2.8.3?
@zihejia same issue is happening with v2.8.3. Please, could you look into this?
hi @igled7 , if it is different, could you share the crash log for v2.8.3? We will take a look.
Thanks @zihejia - Same crash, but I'll add the stack trace of the related active Mixpanel threads.
Crashed: com.mixpanel.archiveQueue
0 CoreFoundation 0x18f46b248 _CFCreateArrayStorage.cold.2 + 16
1 CoreFoundation 0x18f3177cc +[__NSArrayM automaticallyNotifiesObserversForKey:] + 118
2 Foundation 0x1906586c0 -[NSDictionary(NSDictionary) encodeWithCoder:] + 192
3 Foundation 0x19072c4f4 _encodeObject + 1212
4 Foundation 0x190634534 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 380
5 Foundation 0x1906588bc -[NSDictionary(NSDictionary) encodeWithCoder:] + 700
6 Foundation 0x19072c4f4 _encodeObject + 1212
7 Foundation 0x1906350a8 +[NSKeyedArchiver archivedDataWithRootObject:requiringSecureCoding:error:] + 108
8 Mixpanel 0x1078f4844 specialized static Persistence.archiveToFile(_:object:token:) + 164 (Persistence.swift:164)
9 Mixpanel 0x1078f1dd4 closure #1 in static Persistence.archiveProperties(_:token:) + 2972 (<compiler-generated>:2972)
10 Mixpanel 0x1078b3a54 thunk for @callee_guaranteed () -> () + 20 (<compiler-generated>:20)
11 Mixpanel 0x1078b3a74 thunk for @escaping @callee_guaranteed () -> () + 20 (<compiler-generated>:20)
12 libdispatch.dylib 0x18eff1db0 _dispatch_client_callout + 20
13 libdispatch.dylib 0x18f000428 _dispatch_lane_barrier_sync_invoke_and_complete + 60
14 Mixpanel 0x1078f0b90 static Persistence.archive(eventsQueue:peopleQueue:groupsQueue:properties:codelessBindings:variants:token:) + 1108 (<compiler-generated>:1108)
15 Mixpanel 0x1078bed04 closure #1 in MixpanelInstance.archive() + 955 (MixpanelInstance.swift:955)
16 Mixpanel 0x1079425a8 closure #1 in ReadWriteLock.read(closure:) + 20 (ReadWriteLock.swift:20)
17 Mixpanel 0x1078c9784 partial apply for thunk for @callee_guaranteed () -> () + 20 (<compiler-generated>:20)
18 Mixpanel 0x1078b3a74 thunk for @escaping @callee_guaranteed () -> () + 20 (<compiler-generated>:20)
19 libdispatch.dylib 0x18eff1db0 _dispatch_client_callout + 20
20 libdispatch.dylib 0x18f000a54 _dispatch_sync_invoke_and_complete + 60
21 Mixpanel 0x1078b9df0 MixpanelInstance.archive() + 212 (<compiler-generated>:212)
22 Mixpanel 0x1078bc1b4 protocol witness for FlushDelegate.updateQueue(_:type:) in conformance MixpanelInstance + 196 (<compiler-generated>:196)
23 Mixpanel 0x1078eb454 Flush.removeProcessedBatch(batchSize:queue:type:) + 220 (<compiler-generated>:220)
24 Mixpanel 0x1078eb2ec closure #1 in Flush.flushQueueInBatches(_:type:) + 151 (Flush.swift:151)
25 Mixpanel 0x10796a178 partial apply for closure #2 in FlushRequest.sendRequest(_:type:useIP:completion:) + 24 (<compiler-generated>:24)
26 Mixpanel 0x10796a2ec partial apply for closure #2 in FlushRequest.flushRequestHandler(_:resource:completion:) + 164 (<compiler-generated>:164)
27 Mixpanel 0x10796a318 partial apply for thunk for @escaping @callee_guaranteed (@unowned Int, @guaranteed NSURLResponse?) -> () + 24 (<compiler-generated>:24)
28 Mixpanel 0x107906d40 specialized closure #1 in static Network.apiRequest<A>(base:resource:failure:success:) + 436 (<compiler-generated>:436)
29 Mixpanel 0x10790852c partial apply for specialized closure #1 in static Network.apiRequest<A>(base:resource:failure:success:) + 36
30 Mixpanel 0x107906ff0 thunk for @escaping @callee_guaranteed (@guaranteed Data?, @guaranteed NSURLResponse?, @guaranteed Error?) -> () + 148 (<compiler-generated>:148)
31 CFNetwork 0x18fa1af18 CFNetServiceBrowserSearchForServices + 79492
32 CFNetwork 0x18fa2d548 _CFHTTPMessageSetResponseProxyURL + 9200
33 libdispatch.dylib 0x18eff024c _dispatch_call_block_and_release + 32
34 libdispatch.dylib 0x18eff1db0 _dispatch_client_callout + 20
35 libdispatch.dylib 0x18eff910c _dispatch_lane_serial_drain + 580
36 libdispatch.dylib 0x18eff9c90 _dispatch_lane_invoke + 460
37 libdispatch.dylib 0x18f003d78 _dispatch_workloop_worker_thread + 708
38 libsystem_pthread.dylib 0x1dabcf804 _pthread_wqthread + 276
39 libsystem_pthread.dylib 0x1dabd675c start_wqthread + 8
com.mixpanel.74dc35f5daf1026de3ef7dff4d7ea18e.tracking)
0 libsystem_kernel.dylib 0x1bd174f5c __ulock_wait + 8
1 libdispatch.dylib 0x18eff2794 _dlock_wait + 56
2 libdispatch.dylib 0x18eff2528 _dispatch_thread_event_wait_slow + 56
3 libdispatch.dylib 0x18f000708 __DISPATCH_WAIT_FOR_QUEUE__ + 352
4 libdispatch.dylib 0x18f0002b0 _dispatch_sync_f_slow + 148
5 libswiftDispatch.dylib 0x1a4ea9fdc implicit closure #2 in implicit closure #1 in OS_dispatch_queue.sync<A>(flags:execute:) + 196
6 libswiftDispatch.dylib 0x1a4ea94c4 OS_dispatch_queue._syncHelper<A>(fn:execute:rescue:) + 360
7 libswiftDispatch.dylib 0x1a4ea9ee4 OS_dispatch_queue.sync<A>(flags:execute:) + 512
8 Mixpanel 0x1078c0728 closure #1 in MixpanelInstance.track(event:properties:) + 23 (ReadWriteLock.swift:23)
9 Mixpanel 0x1078b3a9c thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:28)
10 libdispatch.dylib 0x18eff024c _dispatch_call_block_and_release + 32
11 libdispatch.dylib 0x18eff1db0 _dispatch_client_callout + 20
12 libdispatch.dylib 0x18eff910c _dispatch_lane_serial_drain + 580
13 libdispatch.dylib 0x18eff9c5c _dispatch_lane_invoke + 408
14 libdispatch.dylib 0x18f003d78 _dispatch_workloop_worker_thread + 708
15 libsystem_pthread.dylib 0x1dabcf804 _pthread_wqthread + 276
16 libsystem_pthread.dylib 0x1dabd675c start_wqthread + 8
com.mixpanel.74dc35f5daf1026de3ef7dff4d7ea18e.network)
0 libsystem_kernel.dylib 0x1bd15030c semaphore_wait_trap + 8
1 libdispatch.dylib 0x18eff2318 _dispatch_sema4_wait + 28
2 libdispatch.dylib 0x18eff29e0 _dispatch_semaphore_wait_slow + 132
3 libswiftDispatch.dylib 0x1a4eb385c OS_dispatch_semaphore.wait(wallTimeout:) + 24
4 Mixpanel 0x1078eaa54 Flush.flushQueueInBatches(_:type:) + 156 (Flush.swift:156)
5 Mixpanel 0x1078bf854 closure #1 in closure #1 in MixpanelInstance.flush(completion:) + 89 (Flush.swift:89)
6 Mixpanel 0x1078b3a9c thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:28)
7 libdispatch.dylib 0x18eff024c _dispatch_call_block_and_release + 32
8 libdispatch.dylib 0x18eff1db0 _dispatch_client_callout + 20
9 libdispatch.dylib 0x18eff910c _dispatch_lane_serial_drain + 580
10 libdispatch.dylib 0x18eff9c5c _dispatch_lane_invoke + 408
11 libdispatch.dylib 0x18f003d78 _dispatch_workloop_worker_thread + 708
12 libsystem_pthread.dylib 0x1dabcf804 _pthread_wqthread + 276
13 libsystem_pthread.dylib 0x1dabd675c start_wqthread + 8
Hi @zihejia,
I believe that the crash is related to a read/write sync issue. Our implementation may trigger flush
while your SDK is updating the experiments in the method applicationDidBecomeActive
. The checkDecide
callback may trigger the method markVariantRun
, which mutates the superProperties
instance variable without any sync lock.
Hello, we're experiencing the same crashes since we upgrade the SDK from 2.7.0 to 2.8.2. The symptoms look similar to other crashes in this issue.
We found there're some data loss in the old version SDK, and upgrading it did help addressed the data loss issue. However this newly introduced crashes became one of our top crashes ... which is more severe than data loss.
@zihejia Do you have any ETA of releasing a fix? If not, do you advise downgrading the SDK (e.g. back to 2.7.0) to avoid the crash?
Pasting the stacktrace below for reference.
Crashed: com.mixpanel.archiveQueue
0 CoreFoundation 0x189988728 __CFBasicHashRehash + 100
1 CoreFoundation 0x18998a2c4 __CFBasicHashAddValue + 100
2 CoreFoundation 0x1899898c4 CFBasicHashAddValue + 2088
3 CoreFoundation 0x1898aa234 CFDictionaryAddValue + 236
4 CoreFoundation 0x189882fd0 _flattenPlist + 288
5 CoreFoundation 0x18988316c _flattenPlist + 700
6 CoreFoundation 0x189883104 _flattenPlist + 596
7 CoreFoundation 0x189882bc4 __CFBinaryPlistWriteOrPresize + 232
8 Foundation 0x18ab096c4 -[NSKeyedArchiver finishEncoding] + 544
9 Foundation 0x18ab0a858 -[NSKeyedArchiver encodedData] + 72
10 Foundation 0x18ab09d40 +[NSKeyedArchiver archivedDataWithRootObject:requiringSecureCoding:error:] + 120
11 Mixpanel 0x1064cd468 specialized static Persistence.archiveToFile(_:object:token:) + 164 (Persistence.swift:164)
12 Mixpanel 0x1064c9a3c closure #1 in static Persistence.archiveEvents(_:token:) + 4437187132
13 Mixpanel 0x10648f7cc thunk for @callee_guaranteed () -> () + 4436948940 (<compiler-generated>:4436948940)
14 Mixpanel 0x10648f7ac thunk for @escaping @callee_guaranteed () -> () + 4436948908 (<compiler-generated>:4436948908)
15 libdispatch.dylib 0x189597280 _dispatch_client_callout + 16
16 libdispatch.dylib 0x18957a0ec _dispatch_lane_barrier_sync_invoke_and_complete + 56
17 Mixpanel 0x1064721fc closure #2 in closure #1 in Group.addGroupRecordToQueueWithAction(_:properties:) + 4436828668 (Group.swift:4436828668)
18 Mixpanel 0x1064d35dc closure #1 in ReadWriteLock.read(closure:) + 20 (ReadWriteLock.swift:20)
19 Mixpanel 0x10648f7cc thunk for @callee_guaranteed () -> () + 4436948940 (<compiler-generated>:4436948940)
20 Mixpanel 0x10648f7ac thunk for @escaping @callee_guaranteed () -> () + 4436948908 (<compiler-generated>:4436948908)
21 libdispatch.dylib 0x189597280 _dispatch_client_callout + 16
22 libdispatch.dylib 0x18957a6cc _dispatch_sync_invoke_and_complete + 56
23 Mixpanel 0x106471cb0 closure #1 in Group.addGroupRecordToQueueWithAction(_:properties:) + 4436827312 (Group.swift:4436827312)
24 Mixpanel 0x10648f7ac thunk for @escaping @callee_guaranteed () -> () + 4436948908 (<compiler-generated>:4436948908)
25 libdispatch.dylib 0x189596298 _dispatch_call_block_and_release + 24
26 libdispatch.dylib 0x189597280 _dispatch_client_callout + 16
27 libdispatch.dylib 0x1895734f0 _dispatch_lane_serial_drain$VARIANT$armv81 + 568
28 libdispatch.dylib 0x189573fdc _dispatch_lane_invoke$VARIANT$armv81 + 404
29 libdispatch.dylib 0x18957d800 _dispatch_workloop_worker_thread + 692
30 libsystem_pthread.dylib 0x1d21855a4 _pthread_wqthread + 272
31 libsystem_pthread.dylib 0x1d2188874 start_wqthread + 8
hi @canyousayyes , sorry for the crash, we don't recommend downgrading to 2.7.0. We will have a look and get back to you.
We are getting crashes in the method
Persistence.archiveToFile(_:object:token:)
This started happening after upgrading to the version 2.7.7. Everything was working fine with 2.7.0.
Environment
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x4d55545a0000040 Persistence.archiveToFile
EXC_BREAKPOINT 0x00000001a45f151c Persistence.archiveToFile
EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x00000058877e4c50 MixpanelInstance.archive()
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000714c5ea34620 Persistence.archiveProperties(_:token:)