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

Closed
KabukiAdam opened this issue Nov 7, 2019 · 12 comments
Closed

[BUG] Crash in FIRRemoteConfig.m #4265

KabukiAdam opened this issue Nov 7, 2019 · 12 comments

Comments

@KabukiAdam
Copy link

[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 has been minimized.

@paulb777
Copy link
Member

paulb777 commented Nov 7, 2019

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

@visumickey
Copy link
Contributor

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
Copy link
Member

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
Copy link

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
Copy link
Contributor

@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
Copy link

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
Copy link

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
Copy link
Contributor

@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
Copy link

siburb commented Nov 26, 2019

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

Remove FirebasePerformance?

@visumickey
Copy link
Contributor

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
@paulb777
Copy link
Member

Fix released with Firebase 6.14.0

@firebase firebase locked and limited conversation to collaborators Jan 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants