Skip to content

[BUG] Crash in FIRRemoteConfig.m #4265

@KabukiAdam

Description

@KabukiAdam

[REQUIRED] Step 2: Describe your environment

  • Xcode version: 11.1
  • Firebase SDK version: 6.10.0
  • Firebase Component: Remote Config
  • Component version: 4.4.3

[REQUIRED] Step 3: Describe the problem

After releasing the latest update to our app, we've started to see this crash in the crash logs.
Seems to be affecting about 5% of users.
Happens on both iOS 12 and iOS 13 devices.

I saw some other Remote Config crashes when I searched the github issues, but I didn't see any with this particular stack trace (or similar).

BUG IN CLIENT OF LIBDISPATCH: dispatch_sync called on queue already owned by current thread

Stack trace:

Crashed: com.google.GoogleConfigService.FIRRemoteConfig
0  libdispatch.dylib              0x1bbfae0f4 __DISPATCH_WAIT_FOR_QUEUE__ + 448
1  libdispatch.dylib              0x1bbfadc84 _dispatch_sync_f_slow + 140
2  Flow                           0x10107b610 -[FIRRemoteConfig lastFetchStatus] + 438 (FIRRemoteConfig.m:438)
3  Flow                           0x10101cc88 -[FPRRemoteConfigFlags performanceSDKEnabled] + 4376562824
4  Flow                           0x10101ae24 -[FPRConfigurations sdkEnabled] + 4376555044
5  Flow                           0x101026df8 -[FPRNetworkTrace initWithURLRequest:] + 4376604152
6  Flow                           0x10102e8f4 __InstrumentDataTaskWithRequestCompletionHandler_block_invoke + 4376635636
7  Flow                           0x10102e88c __InstrumentDataTaskWithRequestCompletionHandler_block_invoke + 4376635532
8  Flow                           0x101006bdc -[FIRInstanceIDCheckinService checkinWithExistingCheckin:completion:] + 189 (FIRInstanceIDCheckinService.m:189)
9  Flow                           0x101004a04 -[FIRInstanceIDAuthService fetchCheckinInfoWithHandler:] + 188 (FIRInstanceIDAuthService.m:188)
10 Flow                           0x100ffe354 -[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler:] + 367 (FIRInstanceID.m:367)
11 Flow                           0x1010882e0 -[RCNConfigFetch refreshInstanceIDTokenAndFetchCheckInInfoWithCompletionHandler:] + 251 (RCNFetch.m:251)
12 Flow                           0x101087f70 __74-[RCNConfigFetch fetchAllConfigsWithExpirationDuration:completionHandler:]_block_invoke + 190 (RCNFetch.m:190)
13 libdispatch.dylib              0x1bbfc9610 _dispatch_call_block_and_release + 24
14 libdispatch.dylib              0x1bbfca184 _dispatch_client_callout + 16
15 libdispatch.dylib              0x1bbfa773c _dispatch_lane_serial_drain$VARIANT$armv81 + 564
16 libdispatch.dylib              0x1bbfa8154 _dispatch_lane_invoke$VARIANT$armv81 + 400
17 libdispatch.dylib              0x1bbfb143c _dispatch_workloop_worker_thread + 576
18 libsystem_pthread.dylib        0x1bc019fa4 _pthread_wqthread + 276
19 libsystem_pthread.dylib        0x1bc01cae0 start_wqthread + 8

I spent a bit of time looking through the source code related to the stack trace, and I can see how the error happens. It looks like [RCNConfigFetch fetchAllConfigsWithExpirationDuration:completionHandler:] does its work on the same dispatch queue that [FIRRemoteConfig lastFetchStatus] uses for its dispatch_sync() call.

I realize that we're a version or two behind on the Firebase SDK. I looked at the release notes and source diff and didn't see anything that looked like a fix for this, but if I'm wrong and updating the SDK will fix this, please let me know. 😄

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions