Crash `specialized _ArrayBuffer._consumeAndCreateNew(bufferIsUnique:minimumCapacity:growForAppend:)`
The Crashlytics shows that some users of an app received a crash specialized _ArrayBuffer._consumeAndCreateNew(bufferIsUnique:minimumCapacity:growForAppend:) when RemoteLogger receives some events.
The code where the crash happened is:
cancellable = store.events.receive(on: connectionQueue).sink { [weak self] in
> self?.didReceive(event: $0)
}
I'm not sure exactly but seems like the case when isLoggingPaused equals true and buffer is called:
private func didReceive(event: LoggerStore.Event) {
if isLoggingPaused {
> buffer?.append(event)
} else {
send(event: event)
}
}
I don't see anything special in the Crashlytics trace, but it might help
# Crashlytics - Stack trace
Crashed: com.github.kean.pulse.remote-logger
0 libsystem_platform.dylib 0xf30 _platform_memmove + 144
1 App 0x2a51dc specialized _ArrayBuffer._consumeAndCreateNew(bufferIsUnique:minimumCapacity:growForAppend:) + 99 (LibcShims.h:99)
2 App 0x309f70 closure #1 in RemoteLogger.initialize(store:) + 128 (RemoteLogger.swift:128)
3 Combine 0x59b8 Subscribers.Sink.receive(_:) + 96
4 Combine 0x5948 protocol witness for Subscriber.receive(_:) in conformance Subscribers.Sink<A, B> + 24
5 Combine 0x56a4 closure #1 in Publishers.ReceiveOn.Inner.receive(_:) + 276
6 libswiftDispatch.dylib 0xe5d8 thunk for @escaping @callee_guaranteed () -> () + 36
7 libdispatch.dylib 0x26a8 _dispatch_call_block_and_release + 32
8 libdispatch.dylib 0x4300 _dispatch_client_callout + 20
9 libdispatch.dylib 0xb894 _dispatch_lane_serial_drain + 748
10 libdispatch.dylib 0xc3c4 _dispatch_lane_invoke + 380
11 libdispatch.dylib 0x17004 _dispatch_root_queue_drain_deferred_wlh + 288
12 libdispatch.dylib 0x16878 _dispatch_workloop_worker_thread + 404
13 libsystem_pthread.dylib 0x1964 _pthread_wqthread + 288
14 libsystem_pthread.dylib 0x1a04 start_wqthread + 8
P.S. Might be useful. About 1-3% of daily active users are faced with this issue. They have different devices and iOS versions. The minimal iOS version is 16
UPD: I've just found one more crash log
Crashed: com.apple.main-thread
0 libswiftCore.dylib 0x3aa748 swift::metadataimpl::FixedSizeBufferValueWitnesses<swift::metadataimpl::ValueWitnesses<swift::metadataimpl::ObjCRetainableBox>, true, 8ul, 8ul, true>::getEnumTagSinglePayload(swift::OpaqueValue const*, unsigned int, swift::TargetMetadata<swift::InProcess> const*) + 4
1 libswiftCore.dylib 0x380228 getEnumTagSinglePayload for ClosedRange<>.Index + 320
2 App 0x29a28c destroy for LoggerStore.Event + 4365312652 (<compiler-generated>:4365312652)
3 libswiftCore.dylib 0x39370c swift_arrayDestroy + 124
4 libswiftCore.dylib 0x9ca18 _ContiguousArrayStorage.__deallocating_deinit + 96
5 libswiftCore.dylib 0x3a6d88 _swift_release_dealloc + 56
6 libswiftCore.dylib 0x3a8424 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 136
7 App 0x309fe0 closure #2 in RemoteLogger.initialize(store:) + 133 (RemoteLogger.swift:133)
8 App 0x307078 thunk for @escaping @callee_guaranteed () -> () + 4365758584 (<compiler-generated>:4365758584)
9 libdispatch.dylib 0x4300 _dispatch_client_callout + 20
10 libdispatch.dylib 0x77b8 _dispatch_continuation_pop + 600
11 libdispatch.dylib 0x1b5c0 _dispatch_source_latch_and_call + 420
12 libdispatch.dylib 0x1a190 _dispatch_source_invoke + 832
13 libdispatch.dylib 0x128a8 _dispatch_main_queue_drain + 744
14 libdispatch.dylib 0x125b0 _dispatch_main_queue_callback_4CF + 44
15 CoreFoundation 0x3720c CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16
16 CoreFoundation 0x33f18 __CFRunLoopRun + 1996
17 CoreFoundation 0x33668 CFRunLoopRunSpecific + 608
18 GraphicsServices 0x35ec GSEventRunModal + 164
19 UIKitCore 0x22c2b4 -[UIApplication _run] + 888
20 UIKitCore 0x22b8f0 UIApplicationMain + 340
21 App 0x13ec10 main + 8 (AppDelegate.swift:8)
Hi !
We've got the same issue here...
If you've got any idea about it, there're welcome :)
Cheers
I also have this crash :(
Hey, thanks for the report. It looks like a threading issue. I'll look into it when I get a chance, and PRs are also always welcome.
Thanks for the report and the provided details. Fixed in Pulse 4.2.