Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Crash in FIRRemoteConfig.m #4265

Open
KabukiAdam opened this issue Nov 7, 2019 · 11 comments
Assignees
Milestone

Comments

@KabukiAdam
Copy link

@KabukiAdam KabukiAdam commented Nov 7, 2019

[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. 😄

@google-oss-bot

This comment was marked as resolved.

Copy link

@google-oss-bot google-oss-bot commented Nov 7, 2019

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.
@paulb777

This comment has been minimized.

Copy link
Member

@paulb777 paulb777 commented Nov 7, 2019

This is likely related to the other crashes involving FirebasePerformance and FirebaseRemoteConfig.

@visumickey

This comment has been minimized.

Copy link

@visumickey visumickey commented Nov 13, 2019

This issue is fixed and will be rolled out in the upcoming release of Firebase Performance.

@visumickey visumickey added this to the M60 milestone Nov 13, 2019
@ryanwilson

This comment has been minimized.

Copy link
Member

@ryanwilson ryanwilson commented Nov 14, 2019

Firebase 6.13.0 was just released and should address this issue. Please update and re-open if you're still seeing the issue, thanks!

@siburb

This comment has been minimized.

Copy link

@siburb siburb commented Nov 25, 2019

Hi @ryanwilson. I work with @KabukiAdam and can confirm that we're still seeing this same crash in the latest release of our app. It is using Firebase 6.13.0, so this issue is not fixed.

@visumickey

This comment has been minimized.

Copy link

@visumickey visumickey commented Nov 25, 2019

@siburb
Can you share the version of Firebase Performance you are using (Podfile.lock should contain it). Can you also add a copy of the most recent crash logs you see as a part of 6.13.0?

@siburb

This comment has been minimized.

Copy link

@siburb siburb commented Nov 26, 2019

Thanks @visumickey - this is our number 1 crash at the moment, we could do with a fix asap.

Here's the trace from thread 9 of an example crash - I can send you the whole log directly if necessary?

Crashed: com.google.GoogleConfigService.FIRRemoteConfig
0  libdispatch.dylib              0x1c04b30e4 __DISPATCH_WAIT_FOR_QUEUE__ + 448
1  libdispatch.dylib              0x1c04b2c74 _dispatch_sync_f_slow + 140
2  Actions                        0x1007690d8 -[FIRRemoteConfig lastFetchStatus] + 438 (FIRRemoteConfig.m:438)
3  Actions                        0x10070a790 -[FPRRemoteConfigFlags performanceSDKEnabled] + 4310116240
4  Actions                        0x10070892c -[FPRConfigurations sdkEnabled] + 4310108460
5  Actions                        0x100714900 -[FPRNetworkTrace initWithURLRequest:] + 4310157568
6  Actions                        0x10071c3fc __InstrumentDataTaskWithRequestCompletionHandler_block_invoke + 4310189052
7  Actions                        0x10071c394 __InstrumentDataTaskWithRequestCompletionHandler_block_invoke + 4310188948
8  Actions                        0x1006d56fc -[FIRInstanceIDCheckinService checkinWithExistingCheckin:completion:] + 189 (FIRInstanceIDCheckinService.m:189)
9  Actions                        0x1006d3524 -[FIRInstanceIDAuthService fetchCheckinInfoWithHandler:] + 188 (FIRInstanceIDAuthService.m:188)
10 Actions                        0x1006cc1d4 -[FIRInstanceID(Private) fetchCheckinInfoWithHandler:] + 35 (FIRInstanceID+Private.m:35)
11 Actions                        0x100776338 -[RCNConfigFetch fetchCheckinInfoWithCompletionHandler:] + 289 (RCNFetch.m:289)
12 Actions                        0x100776270 __81-[RCNConfigFetch refreshInstanceIDTokenAndFetchCheckInInfoWithCompletionHandler:]_block_invoke.146 + 246 (RCNFetch.m:246)
13 libdispatch.dylib              0x1c04ce610 _dispatch_call_block_and_release + 24
14 libdispatch.dylib              0x1c04cf184 _dispatch_client_callout + 16
15 libdispatch.dylib              0x1c04ac710 _dispatch_lane_serial_drain$VARIANT$armv81 + 564
16 libdispatch.dylib              0x1c04ad128 _dispatch_lane_invoke$VARIANT$armv81 + 400
17 libdispatch.dylib              0x1c04b643c _dispatch_workloop_worker_thread + 576
18 libsystem_pthread.dylib        0x1c051ef88 _pthread_wqthread + 276
19 libsystem_pthread.dylib        0x1c0521ad4 start_wqthread + 8

Crashlytics also shows the following:
"BUG IN CLIENT OF LIBDISPATCH: dispatch_sync called on queue already owned by current thread"

Here's an extract from "podfile.lock":

  - Firebase/Performance (6.13.0):
    - Firebase/CoreOnly
    - FirebasePerformance (~> 3.1.7)

<other stuff>

  - FirebasePerformance (3.1.7):
    - FirebaseCore (~> 6.4)
    - FirebaseInstanceID (~> 4.2)
    - FirebaseRemoteConfig (~> 4.4)
    - GoogleToolboxForMac/Logger (~> 2.1)
    - "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
    - GoogleUtilities/Environment (~> 6.2)
    - GoogleUtilities/ISASwizzler (~> 6.2)
    - GoogleUtilities/MethodSwizzler (~> 6.2)
    - GTMSessionFetcher/Core (~> 1.1)
    - Protobuf (~> 3.9)
@siburb

This comment has been minimized.

Copy link

@siburb siburb commented Nov 26, 2019

This is recognised as a different crash in Crashlytics, and is also happening regularly. Sounds very similar though.

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

Thread 9:

Crashed: com.google.GoogleConfigService.FIRRemoteConfig
0  (Missing)                      0x1b8071bac (Missing)
1  (Missing)                      0x0 (Missing)
2  (Missing)                      0x0 (Missing)
3  Actions                        0x1007b2778 -[FPRRemoteConfigFlags performanceSDKEnabledWithDefaultValue:] + 4311967608
4  Actions                        0x1007b0a64 -[FPRConfigurations sdkEnabled] + 4311960164
5  Actions                        0x1007bca04 -[FPRNetworkTrace initWithURLRequest:] + 4312009220
6  Actions                        0x1007c4500 __InstrumentDataTaskWithRequestCompletionHandler_block_invoke + 4312040704
7  Actions                        0x1007c4498 __InstrumentDataTaskWithRequestCompletionHandler_block_invoke + 4312040600
8  Actions                        0x10077ed6c -[FIRInstanceIDCheckinService checkinWithExistingCheckin:completion:] + 189 (FIRInstanceIDCheckinService.m:189)
9  Actions                        0x10077cb94 -[FIRInstanceIDAuthService fetchCheckinInfoWithHandler:] + 188 (FIRInstanceIDAuthService.m:188)
10 Actions                        0x100775824 -[FIRInstanceID(Private) fetchCheckinInfoWithHandler:] + 35 (FIRInstanceID+Private.m:35)
11 Actions                        0x10081dfb8 -[RCNConfigFetch fetchCheckinInfoWithCompletionHandler:] + 289 (RCNFetch.m:289)
12 Actions                        0x10081def0 __81-[RCNConfigFetch refreshInstanceIDTokenAndFetchCheckInInfoWithCompletionHandler:]_block_invoke.146 + 246 (RCNFetch.m:246)
13 (Missing)                      0x1b8063c2c (Missing)
14 (Missing)                      0x74650681b8065000 (Missing)
15 (Missing)                      0x0 (Missing)
16 (Missing)                      0x3a4f5b01b806c000 (Missing)
17 (Missing)                      0x0 (Missing)
18 (Missing)                      0x0 (Missing)
19 (Missing)                      0x0 (Missing)
@visumickey

This comment has been minimized.

Copy link

@visumickey visumickey commented Nov 26, 2019

@siburb Thanks for the crash reports. We are able to get to the root of this issue and this is already fixed. We will make sure to ship the fix out in the next release (Expected within the next 2 weeks).

@visumickey visumickey reopened this Nov 26, 2019
@visumickey visumickey modified the milestones: 6.13.0, M60.1 Nov 26, 2019
@siburb

This comment has been minimized.

Copy link

@siburb siburb commented Nov 26, 2019

Thanks. Is there anything that we can do in the meantime to prevent it from happening?

Remove FirebasePerformance?

@visumickey

This comment has been minimized.

Copy link

@visumickey visumickey commented Nov 26, 2019

@siburb
There are a couple of options:

Option 1:
Remove Firebase Performance. After the fix rolling out, you could just re-enable it and you are all set.

Option 2:
Disable instrumentation (automatic performance monitoring) to avoid this crash. This could be done using this API. To re-enable, you would have to use the same API with a value of 'YES'. Since this is a persisted config, you would have to re-enable this in all your releases.

@paulb777 paulb777 modified the milestones: M60.1, M61 Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.