firebase-ios-sdk: [APMIdentity appInstanceID] main thread block
[REQUIRED] Step 1: Describe your environment
- Xcode version: 11.6
- Firebase SDK version: 6.31.0
- Firebase Component: Analytics (Auth, Core, Database, Firestore, Messaging, Storage, etc)
- Installation method: CocoaPods
[REQUIRED] Step 2: My Question
Same issue there,For iOS 14,we have to update it. when update ‘Firebase/Analytics’ to 6.31.0,It happens very ofen.now this is our top one main thread block.Please try to fix it.
Sdk version: ‘Firebase/Analytics’ 6.31.0 Google-Mobile-Ads-SDK (>= 7.55.0)
Key Stack Info Below:
Thread 0:
0 libsystem_kernel.dylib 0x188acb93c kevent_id (in libsystem_kernel.dylib) + 8
1 libdispatch.dylib 0x18892bbf0 _dispatch_kq_poll (in libdispatch.dylib) + 332
2 libdispatch.dylib 0x18892c6dc _dispatch_event_loop_wait_for_ownership$VARIANT$mp (in libdispatch.dylib) + 412
3 libdispatch.dylib 0x18891be9c DISPATCH_WAIT_FOR_QUEUE (in libdispatch.dylib) + 296
4 libdispatch.dylib 0x18891bad4 _dispatch_sync_f_slow (in libdispatch.dylib) + 140
5 XXXX 0x102398bb4 -[APMIdentity appInstanceID] (in XXXX) + 144
6 XXXX 0x1023ac194 -[APMIdentifiers appInstanceID] (in XXXX) + 188
7 XXXX 0x10252a9a8 GADAnalyticsAdRequestDictionary (in XXXX) + 132
8 XXXX 0x1024eb840 GADAnalyticsSettingsSignalSource (in XXXX) + 168
9 XXXX 0x10251bb84 GAD_GADSignals_arm64_7_55_0 (in XXXX) + 3868
10 libdispatch.dylib 0x18896ca38 _dispatch_call_block_and_release (in libdispatch.dylib) + 24
11 libdispatch.dylib 0x18896d7d4 _dispatch_client_callout (in libdispatch.dylib) + 16
12 libdispatch.dylib 0x18891b004 _dispatch_main_queue_callback_4CF$VARIANT$mp (in libdispatch.dylib) + 1068
13 CoreFoundation 0x188ebec1c CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE (in CoreFoundation) + 12
14 CoreFoundation 0x188eb9b54 __CFRunLoopRun (in CoreFoundation) + 1924
15 CoreFoundation 0x188eb90b0 CFRunLoopRunSpecific (in CoreFoundation) + 436
16 GraphicsServices 0x18b0b979c GSEventRunModal (in GraphicsServices) + 104
17 UIKitCore 0x1b56ef978 UIApplicationMain (in UIKitCore) + 212
18 XXXX 0x1030560ec _main (in XXXX) (main.m:49)
19 libdyld.dylib 0x18897e8e0 start (in libdyld.dylib) + 4
Thread 42:
0 libsystem_kernel.dylib 0x188acb93c kevent_id (in libsystem_kernel.dylib) + 8
1 libdispatch.dylib 0x18892bbf0 _dispatch_kq_poll (in libdispatch.dylib) + 332
2 libdispatch.dylib 0x18892c2a0 _dispatch_event_loop_wake_owner$VARIANT$mp (in libdispatch.dylib) + 368
3 libdispatch.dylib 0x18891cc44 _dispatch_waiter_wake (in libdispatch.dylib) + 60
4 libdispatch.dylib 0x18891bf70 _dispatch_sync_complete_recurse (in libdispatch.dylib) + 60
5 libdispatch.dylib 0x18891bffc _dispatch_sync_invoke_and_complete_recurse (in libdispatch.dylib) + 88
6 libdispatch.dylib 0x18891baf0 _dispatch_sync_f_slow (in libdispatch.dylib) + 168
7 XXXX 0x102398bb4 -[APMIdentity appInstanceID] (in XXXX) + 144
8 XXXX 0x1023d2a20 -[APMMeasurement(Event) createRawEventMetadataWithUserAttributes:] (in XXXX) + 340
9 XXXX 0x1023d53ec -[APMMeasurement(Event) writeEvent:isPublicEvent:isRealtime:] (in XXXX) + 796
10 XXXX 0x1023d2888 __49-[APMMeasurement(Event) writeEventOnWorkerQueue:]_block_invoke (in XXXX) + 604
11 XXXX 0x1023beda8 -[APMSqliteStore performTransactionWithError:block:] (in XXXX) + 176
12 XXXX 0x10238bb14 -[APMDatabase performTransaction:] (in XXXX) + 48
13 XXXX 0x1023d254c -[APMMeasurement(Event) writeEventOnWorkerQueue:] (in XXXX) + 820
14 XXXX 0x1023d20a8 -[APMMeasurement(Event) handleEventOnWorkerQueue:] (in XXXX) + 540
15 XXXX 0x10239e580 -[APMMeasurement logEventOnWorkerQueue:notifyEventListeners:] (in XXXX) + 148
16 XXXX 0x10239e378 -[APMMeasurement logEventOnWorkerQueueWithOrigin:isPublicEvent:name:parameters:timestamp:enabled:ignoreEnabled:ignoreInterceptor:interceptor:addedScreenParameters:] (in XXXX) + 340
17 XXXX 0x10239e17c __151-[APMMeasurement logEventWithOrigin:isPublicEvent:name:parameters:timestamp:enabled:ignoreEnabled:ignoreInterceptor:interceptor:addedScreenParameters:]_block_invoke (in XXXX) + 68
18 XXXX 0x1023a9f84 __51-[APMScheduler scheduleOnWorkerQueueBlockID:block:]_block_invoke (in XXXX) + 44
19 libdispatch.dylib 0x18896ca38 _dispatch_call_block_and_release (in libdispatch.dylib) + 24
20 libdispatch.dylib 0x18896d7d4 _dispatch_client_callout (in libdispatch.dylib) + 16
21 libdispatch.dylib 0x188916320 _dispatch_lane_serial_drain$VARIANT$mp (in libdispatch.dylib) + 592
22 libdispatch.dylib 0x188916e3c _dispatch_lane_invoke$VARIANT$mp (in libdispatch.dylib) + 428
23 libdispatch.dylib 0x18891f4a8 _dispatch_workloop_worker_thread (in libdispatch.dylib) + 596
24 libsystem_pthread.dylib 0x188b4d114 _pthread_wqthread (in libsystem_pthread.dylib) + 304
Thread 68:
0 libsystem_kernel.dylib 0x188abf0f4 mach_msg_trap (in libsystem_kernel.dylib) + 8
1 libsystem_kernel.dylib 0x188abe5a0 mach_msg (in libsystem_kernel.dylib) + 72
2 libdispatch.dylib 0x188924880 _dispatch_mach_send_and_wait_for_reply (in libdispatch.dylib) + 500
3 libdispatch.dylib 0x188924d10 dispatch_mach_send_with_result_and_wait_for_reply$VARIANT$mp (in libdispatch.dylib) + 52
4 libxpc.dylib 0x188b8391c xpc_connection_send_message_with_reply_sync (in libxpc.dylib) + 204
5 Foundation 0x189aafa28 NSXPCCONNECTION_IS_WAITING_FOR_A_SYNCHRONOUS_REPLY (in Foundation) + 12
6 Foundation 0x189892f60 -[NSXPCConnection sendInvocation:orArguments:count:methodSignature:selector:withProxy:] (in Foundation) + 3608
7 CoreFoundation 0x188f3276c forwarding (in CoreFoundation) + 552
8 CoreFoundation 0x188f3475c forwarding_prep_0 (in CoreFoundation) + 92
9 CoreServices 0x1b1896ce4 -[LSApplicationWorkspace deviceIdentifierForAdvertising] (in CoreServices) + 160
10 AdSupport 0x198f70a60 -[ASIdentifierManager advertisingIdentifier] (in AdSupport) + 56
11 XXXX 0x100afc998 -[APMASIdentifierWrapper resettableDeviceIDStringIfAvailable] (in XXXX) + 140
12 XXXX 0x1023997e0 __32-[APMIdentity updateIdentifiers]_block_invoke (in XXXX) + 452
13 libdispatch.dylib 0x18896ca38 _dispatch_call_block_and_release (in libdispatch.dylib) + 24
14 libdispatch.dylib 0x18896d7d4 _dispatch_client_callout (in libdispatch.dylib) + 16
15 libdispatch.dylib 0x188916320 _dispatch_lane_serial_drain$VARIANT$mp (in libdispatch.dylib) + 592
16 libdispatch.dylib 0x188916e3c _dispatch_lane_invoke$VARIANT$mp (in libdispatch.dylib) + 428
17 libdispatch.dylib 0x18891f4a8 _dispatch_workloop_worker_thread (in libdispatch.dylib) + 596
18 libsystem_pthread.dylib 0x188b4d114 _pthread_wqthread (in libsystem_pthread.dylib) + 304
I think it’s thread 68 call [APMIdentity updateIdentifiers] and trigger xpc_connection_send_message.this may cost a lot of time sometimes.So when in main thread call -[APMIdentity appInstanceID],we must wait xpc done and main thrad block happen.maybe can we dispatch GADAnalyticsAdRequestDictionary to other thread?
If you need more info,please reply me thanks.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 50 (23 by maintainers)
In early 2022, we will provide an Early Access Program (EAP) build, which would enable the workaround by default. This will require app developers to rebuild apps with the EAP, publish apps to the App Store, and monitor crashes of new apps. Once we have the EAP build, I will update the related info here.
Today is April 6th, when will the unity version be updated?
8.14.0 is now available
I have found it’s the multi-thread access cause these two threads call appIDFromGMP(sync methods) to enter deadlock. appIDFromGMP is not thread safe is the key problem of this issue.
I’m receiving the same crashes with Firebase 8.9.1.