urbanairship / ios-library

Urban Airship iOS SDK
http://urbanairship.com
Apache License 2.0
478 stars 265 forks source link

Various crashes in async calls #397

Closed gfoldv closed 5 months ago

gfoldv commented 5 months ago

Preliminary Info

What Airship dependencies are you using?

17.8.0

What are the versions of any relevant development tools you are using?

Xcode 15.1

Report

What unexpected behavior are you seeing?

Crashlytics reports various crashes, based on the same error.

(5) suspend resume partial function for closure #1 in AirshipContact.airshipReady() + 4341670020 

DeferredAPIClient.swift - Line 57
(3) suspend resume partial function for specialized DeferredAPIClient.resolve(url:channelID:contactID:stateOverrides:audienceOverrides:triggerContext:) + 57 

AudienceOverridesProvider.swift - Line 195
(7) suspend resume partial function for DefaultAudienceOverridesProvider.channelOverrides(channelID:contactID:) + 195 

ChannelRegistrar.swift - Line 159
(9) suspend resume partial function for ChannelRegistrar.handleRegistrationWorkRequest(_:) + 159 

Have switched from 16.x to 17.8, therefore do not know at which version in between this started to occur.

crow commented 5 months ago

Looking into this, thanks for the report

rlepinski commented 5 months ago

@gfoldv Could you share more info on the crashes:

gfoldv commented 5 months ago

@rlepinski First of all, the crash is rare. It is just annoying, because it appears in the Crashlytics. It happens for 1 out of 10.000 users. On all crash reports, the OS is iOS 17 (17.3.0, 17.3.1, 17.4.0, 17.4.1). The devices are every possible models. Both iPhone and iPad.

Crashed: com.apple.root.user-initiated-qos.cooperative
0  libswiftCore.dylib             0x3ab354 _swift_release_dealloc + 32
1  libswiftCore.dylib             0x3ac488 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 136
2  <OwnApp>                    0x821fc8 outlined consume of ChannelRegistrationPayload? + 4353286088 (<compiler-generated>:4353286088)
3  <OwnApp>                    0x821e94 outlined release of ChannelRegistrationPayload? + 4353285780 (<compiler-generated>:4353285780)
4  <OwnApp>                    0x8206ac (5) suspend resume partial function for ChannelRegistrar.registrationSuccess(channelID:registrationInfo:) + 287 (ChannelRegistrar.swift:287)
5  libswift_Concurrency.dylib     0x4d764 swift::runJobInEstablishedExecutorContext(swift::Job*) + 436
6  libswift_Concurrency.dylib     0x4e9c8 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
7  libdispatch.dylib              0x15894 _dispatch_root_queue_drain + 392
8  libdispatch.dylib              0x1609c _dispatch_worker_thread2 + 156
9  libsystem_pthread.dylib        0x1ee4 _pthread_wqthread + 228
10 libsystem_pthread.dylib        0x1fc0 start_wqthread + 8
Crashed: com.apple.root.utility-qos.cooperative
0  libswiftCore.dylib             0x3ab354 _swift_release_dealloc + 32
1  libswiftCore.dylib             0x3ac488 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 136
2  <OwnApp>                    0x89ce14 (3) suspend resume partial function for specialized DeferredAPIClient.resolve(url:channelID:contactID:stateOverrides:audienceOverrides:triggerContext:) + 57 (DeferredAPIClient.swift:57)
3  libswift_Concurrency.dylib     0x4d764 swift::runJobInEstablishedExecutorContext(swift::Job*) + 436
4  libswift_Concurrency.dylib     0x4e9c8 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
5  libdispatch.dylib              0x15894 _dispatch_root_queue_drain + 392
6  libdispatch.dylib              0x1609c _dispatch_worker_thread2 + 156
7  libsystem_pthread.dylib        0x1ee4 _pthread_wqthread + 228
8  libsystem_pthread.dylib        0x1fc0 start_wqthread + 8
Crashed: com.apple.root.user-initiated-qos.cooperative
0  libswiftCore.dylib             0x3a68fc <redacted> + 32
1  libswiftCore.dylib             0x3a7fb0 <redacted> + 136
2  libswiftCore.dylib             0x37bb04 <redacted> + 36
3  libswiftCore.dylib             0x37fc54 <redacted> + 336
4  Combine                        0x25a58 Publishers.RemoveDuplicates.Inner.receive(newValue:) + 800
5  Combine                        0xcf6c FilterProducer.receive(_:) + 1276
6  Combine                        0xca64 protocol witness for Subscriber.receive(_:) in conformance FilterProducer<A, B, C, D, E> + 24
7  Combine                        0x19434 Publishers.Map.Inner.receive(_:) + 200
8  Combine                        0xd448 FilterProducer.receive(_:) + 2520
9  Combine                        0xca64 protocol witness for Subscriber.receive(_:) in conformance FilterProducer<A, B, C, D, E> + 24
10 Combine                        0x23164 Publishers.CompactMap.Inner.receive(_:) + 436
11 Combine                        0x2baa4 Publishers.Concatenate.Inner.suffixReceive(_:) + 244
12 Combine                        0x2b9a4 Publishers.Concatenate.Inner.SuffixSubscriber.receive(_:) + 24
13 Combine                        0x22ec8 PassthroughSubject.Conduit.offer(_:) + 708
14 Combine                        0x22bf4 partial apply for closure #1 in PassthroughSubject.send(_:) + 68
15 Combine                        0x30cc4 partial apply for thunk for @callee_guaranteed (@guaranteed ConduitBase<A, B>) -> (@error @owned Error) + 32
16 libswiftCore.dylib             0xdd538 $sSTsE7forEachyyy7ElementQzKXEKF + 740
17 Combine                        0x22b70 ConduitList.forEach(_:) + 240
18 Combine                        0x22a2c PassthroughSubject.send(_:) + 264
19 <OwnApp>                    0x77a084 (5) suspend resume partial function for closure #1 in AirshipContact.airshipReady() + 4348485764
20 libswift_Concurrency.dylib     0x41ac4 <redacted> + 436
21 libswift_Concurrency.dylib     0x42d54 <redacted> + 72
22 libdispatch.dylib              0x15be4 <redacted> + 392
23 libdispatch.dylib              0x163ec <redacted> + 156
24 libsystem_pthread.dylib        0x1928 _pthread_wqthread + 228
25 libsystem_pthread.dylib        0x1a04 start_wqthread + 8
rlepinski commented 5 months ago

Thanks for the info. In 18.0.x we did a lot of sendable fixes and I am going to release 18.1.0 this week with weak references in blocks in most of those crash sites. I don't expect those to be causing issues since they are holding on a strong reference to basically a singleton, but maybe when everything else is being torn down that is causing an issue? If we can get you to update to 18.1 when it is released and see if you still get crashes we will report this to apple.

rlepinski commented 5 months ago

18.1.0 is out. Going to close this assuming it fixes it but please reopen if you update and are still getting those crashes.