Firebase-ios-sdk: Crash in -[GULUserDefaults setIsPreferenceFileExcluded:]

Created on 16 Nov 2020  路  8Comments  路  Source: firebase/firebase-ios-sdk

  • Xcode version: 12.1
  • Firebase SDK version: 7.0
  • Installation method: CocoaPods
  • Firebase Component: GoogleUtilities

Steps to reproduce:

After upgrading Firebase/Crashlytics & Firebase/Analytics from 6.23.0 to 7.0, we saw a large spike in crashes in GULUserDefaults setIsPreferenceFileExcluded.

Crashed: NSOperationQueue 0x1038cafd0 (QOS: UNSPECIFIED)
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000934059b80

The crash is iOS 14 specific, and affects ~0.5% of our users. We aren't able to reproduce the issue.

In the same release, we started building our app with the iOS 14 SDK.

GoogleUtilities needs-info

Most helpful comment

Thank you all for taking a look. The crash turned out to be caused by another SDK we are using, IRSurveyLib.

Disabling IRSurveyLib SDK, which is where the functionIRInterfaceOrientationAngleOfOrientation is defined, seems to have resolved the crash.

All 8 comments

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.

Can you share the full symbolicated stack trace?

Crashed: NSOperationQueue 0x11a867e20 (QOS: UNSPECIFIED)
0  libobjc.A.dylib                0x1c589d5d4 objc_msgSend + 20
1  Foundation                     0x1b31de834 -[NSError localizedDescription] + 36
2  App                    0x10155e044 -[GULUserDefaults setIsPreferenceFileExcluded:] + 39 (GULUserDefaults.m:39)
3  App                    0x10155d744 -[GULUserDefaults setIsPreferenceFileExcluded:] + 39 (GULUserDefaults.m:39)
4  App                    0x101561b2c IRInterfaceOrientationAngleOfOrientation + 4319222572
5  App                    0x101561910 IRInterfaceOrientationAngleOfOrientation + 4319222032
6  Foundation                     0x1b32a5cc8 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
7  Foundation                     0x1b31a2b18 -[NSBlockOperation main] + 100
8  Foundation                     0x1b32a7f80 __NSOPERATION_IS_INVOKING_MAIN__ + 20
9  Foundation                     0x1b31a27d4 -[NSOperation start] + 784
10 Foundation                     0x1b32a8978 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 20
11 Foundation                     0x1b32a8444 __NSOQSchedule_f + 180
12 libdispatch.dylib              0x1b1c20cb8 _dispatch_block_async_invoke2 + 104
13 libdispatch.dylib              0x1b1c3e280 _dispatch_client_callout + 16
14 libdispatch.dylib              0x1b1c16c04 _dispatch_continuation_pop$VARIANT$armv81 + 404
15 libdispatch.dylib              0x1b1c1636c _dispatch_async_redirect_invoke + 588
16 libdispatch.dylib              0x1b1c23458 _dispatch_root_queue_drain + 344
17 libdispatch.dylib              0x1b1c23bf8 _dispatch_worker_thread2 + 112
18 libsystem_pthread.dylib        0x1f7d73568 _pthread_wqthread + 212
19 libsystem_pthread.dylib        0x1f7d76874 start_wqthread + 8

These two lines in the stack trace (which are responsible for the crash)

0  libobjc.A.dylib                0x1c589d5d4 objc_msgSend + 20
1  Foundation                     0x1b31de834 -[NSError localizedDescription] + 36

indicate something is smashing the NSError object that's being printed. Can you try running your app with some sanitizers enabled to see if there are memory issues at runtime? It's possible upgrading the version of the Firebase SDK exposed a memory corruption issue that previously wasn't causing crashes.

Hmm, this also seems strange because it looks like we define this property but we don't ever do anything with it: https://github.com/firebase/firebase-ios-sdk/blob/fa5ff62138a251dd45af1c927d34591a97539815/GoogleUtilities/UserDefaults/GULUserDefaults.m#L39

We should look at that to be sure it can be removed safely.

The stack trace is likely bogus. After releasing a new version with Firebase 7.1.0, we have a similar frequency crash in a new location:

Crashed: NSOperationQueue 0x1234a8250 (QOS: UNSPECIFIED)
0  libobjc.A.dylib                0x1c08415d4 objc_msgSend + 20
1  App                            0x1030b1be8 __60-[NSURLSession(GULPromises) gul_dataTaskPromiseWithRequest:]_block_invoke_2 + 42 (NSURLSession+GULPromises.m:42)
2  App                            0x1030b12e8 __60-[NSURLSession(GULPromises) gul_dataTaskPromiseWithRequest:]_block_invoke_2 + 42 (NSURLSession+GULPromises.m:42)
3  App                            0x1030b56d0 IRInterfaceOrientationAngleOfOrientation + 4321597136
4  App                            0x1030b54b4 IRInterfaceOrientationAngleOfOrientation + 4321596596
5  Foundation                     0x1ae249cc8 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
6  Foundation                     0x1ae146b18 -[NSBlockOperation main] + 100
7  Foundation                     0x1ae24bf80 __NSOPERATION_IS_INVOKING_MAIN__ + 20
8  Foundation                     0x1ae1467d4 -[NSOperation start] + 784
9  Foundation                     0x1ae24c978 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 20
10 Foundation                     0x1ae24c444 __NSOQSchedule_f + 180
11 libdispatch.dylib              0x1acbc4cb8 _dispatch_block_async_invoke2 + 104
12 libdispatch.dylib              0x1acbe2280 _dispatch_client_callout + 16
13 libdispatch.dylib              0x1acbbac04 _dispatch_continuation_pop$VARIANT$armv81 + 404
14 libdispatch.dylib              0x1acbba36c _dispatch_async_redirect_invoke + 588
15 libdispatch.dylib              0x1acbc7458 _dispatch_root_queue_drain + 344
16 libdispatch.dylib              0x1acbc7bf8 _dispatch_worker_thread2 + 112
17 libsystem_pthread.dylib        0x1f2c87568 _pthread_wqthread + 212
18 libsystem_pthread.dylib        0x1f2c8a874 start_wqthread + 8

So far I didn't find anything with sanitizers

@russellporter That's really interesting because gul_dataTaskPromiseWithRequest method is not used anywhere in Firebase 7.1.0. I curious if it is used by your application or another SDK? Do you know where the function IRInterfaceOrientationAngleOfOrientation is defined?

Thank you all for taking a look. The crash turned out to be caused by another SDK we are using, IRSurveyLib.

Disabling IRSurveyLib SDK, which is where the functionIRInterfaceOrientationAngleOfOrientation is defined, seems to have resolved the crash.

Was this page helpful?
0 / 5 - 0 ratings