Firebase-ios-sdk: iOS 9 crashes after Xcode 11.4

Created on 31 Mar 2020  路  19Comments  路  Source: firebase/firebase-ios-sdk

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 11.4
  • Firebase SDK version: 6.9.0
  • Firebase Component: Analytics
  • Component version: 6.1.2
  • Installation method: CocoaPods

[REQUIRED] Step 2: Describe the problem

I haven't updated Firebase/Analytics SDK in a while, but yesterday I started gettings tons of new crashes in many parts of the SDK after updating my app. The updated app was built with Xcode 11.4, which I suspect is the issue because I didn't change anything related to the SDK itself or the usage of the SDK.

Steps to reproduce:

These crashes are mostly on iOS 9, although I see a few on iOS 10 as well. I'm having trouble reproing them, so all crash reports are from production.

Crash Traces

Here are some crash traces
This one has 26 crashes so far:
com.scribbletogether.scribble_issue_crash_7e178704a3ad4bfeb8f00348edf9667b_DNE_0_v2.txt

Most of the rest of the crashes are one-off. Each crash trace is unique. There are ~90 issues each one with a new unique trace.
Screen Shot 2020-03-31 at 9 44 22 AM
Here is an example of one:
APMDatabase Crash

Xcode 11.4 - 32 bit analytics

Most helpful comment

From the Xcode 11.5 Beta release notes: _Fixed an issue with incorrect code generation when targeting armv7 devices. (61901594)_

Going to mark this resolved by avoiding Xcode 11.4 with either earlier or later Xcode versions.

All 19 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.

I'm going to update my app with the newest version of Firebase/Analytics and by using Xcode 11.31 because these crashes are urgent. I don't know how to test if the cause of the crash is Firebase/Analytics being out of date, or if any version built with Xcode 11.4 will cause similar issues.

Might be related to #4278?

In #4278 it was caused by a call to sqlite3_shutdown, right? I don't see any calls to that method in my app. I use SQLite.swift and only use it on the main thread. It is only one database that I open and update, so I never close it during the lifetime of the app.

Is this reproducible on 6.21.0? iirc Analytics had a few sqlite crash fixes in the releases between 6.9.0 and now.

I鈥檒l push an update with v6.21.0 and build with Xcode 11.3.1. I really hope it fixes the issues. I don鈥檛 have an iOS 9 device to test with, but I鈥檝e ordered one that should help determine the cause of the issue.

Sent with GitHawk

We've done some additional testing with Xcode 11.4 and iOS 9 and haven't found any problems.

I more strongly suspect the issue is somehow related to the sqlite integration ...

Thank you for looking into it more! I'll also look more in my app. I use a single SQLite connection using SQLITE_OPEN_FULLMUTEX, and most of the calls are from the main thread. I don't see any of my methods using a sqlite database showing up in any of the crash traces. I'll see if others on SQLite.swift are seeing problems.

I'm also seeing a huge number of new crashes on a new release - same Firebase versions as my last release, but using Xcode 11.4. They mostly all appear to be on 32 bit devices like the iPhone 5c and iPad 4 on iOS 10.

Screenshot 2020-04-01 at 09 48 03

Pods:

  • Crashlytics (3.14.0):

    • Fabric (~> 1.10.2)

  • Fabric (1.10.2)
  • Firebase/Core (6.14.0):

    • Firebase/CoreOnly

    • FirebaseAnalytics (= 6.1.7)

  • Firebase/CoreOnly (6.14.0):

    • FirebaseCore (= 6.5.0)

  • FirebaseABTesting (3.2.0):

    • FirebaseAnalyticsInterop (~> 1.3)

    • FirebaseCore (~> 6.1)

    • Protobuf (>= 3.9.2, ~> 3.9)

  • FirebaseAnalytics (6.1.7):

    • FirebaseCore (~> 6.5)

    • FirebaseInstanceID (~> 4.2)

    • GoogleAppMeasurement (= 6.1.7)

    • GoogleUtilities/AppDelegateSwizzler (~> 6.0)

    • GoogleUtilities/MethodSwizzler (~> 6.0)

    • GoogleUtilities/Network (~> 6.0)

    • "GoogleUtilities/NSData+zlib (~> 6.0)"

    • nanopb (= 0.3.9011)

  • FirebaseAnalyticsInterop (1.5.0)
  • FirebaseCore (6.5.0):

    • FirebaseCoreDiagnostics (~> 1.0)

    • FirebaseCoreDiagnosticsInterop (~> 1.0)

    • GoogleUtilities/Environment (~> 6.4)

    • GoogleUtilities/Logger (~> 6.4)

  • FirebaseCoreDiagnostics (1.2.2):

    • FirebaseCoreDiagnosticsInterop (~> 1.2)

    • GoogleDataTransportCCTSupport (~> 2.0)

    • GoogleUtilities/Environment (~> 6.5)

    • GoogleUtilities/Logger (~> 6.5)

    • nanopb (~> 0.3.901)

  • FirebaseCoreDiagnosticsInterop (1.2.0)
  • FirebaseDynamicLinks (4.0.7):

    • FirebaseAnalyticsInterop (~> 1.3)

    • FirebaseCore (~> 6.2)

  • FirebaseInstanceID (4.2.8):

    • FirebaseCore (~> 6.5)

    • GoogleUtilities/Environment (~> 6.4)

    • GoogleUtilities/UserDefaults (~> 6.4)

  • FirebaseRemoteConfig (4.4.9):

    • FirebaseABTesting (~> 3.1)

    • FirebaseAnalyticsInterop (~> 1.4)

    • FirebaseCore (~> 6.2)

    • FirebaseInstanceID (~> 4.2)

    • GoogleUtilities/Environment (~> 6.2)

    • "GoogleUtilities/NSData+zlib (~> 6.2)"

    • Protobuf (>= 3.9.2, ~> 3.9)

  • GoogleAnalytics (3.17.0)
  • GoogleAppMeasurement (6.1.7):

    • GoogleUtilities/AppDelegateSwizzler (~> 6.0)

    • GoogleUtilities/MethodSwizzler (~> 6.0)

    • GoogleUtilities/Network (~> 6.0)

    • "GoogleUtilities/NSData+zlib (~> 6.0)"

    • nanopb (= 0.3.9011)

  • GoogleDataTransport (5.0.0)
  • GoogleDataTransportCCTSupport (2.0.0):

    • GoogleDataTransport (~> 5.0)

    • nanopb (~> 0.3.901)

  • GoogleSymbolUtilities (1.1.2)
  • GoogleTagManager (7.1.2):

    • FirebaseAnalytics (~> 6.0)

    • GoogleAnalytics (~> 3.17)

    • GoogleUtilitiesLegacy (~> 1.3)

  • GoogleUtilities/AppDelegateSwizzler (6.5.2):

    • GoogleUtilities/Environment

    • GoogleUtilities/Logger

    • GoogleUtilities/Network

  • GoogleUtilities/Environment (6.5.2)
  • GoogleUtilities/Logger (6.5.2):

    • GoogleUtilities/Environment

  • GoogleUtilities/MethodSwizzler (6.5.2):

    • GoogleUtilities/Logger

  • GoogleUtilities/Network (6.5.2):

    • GoogleUtilities/Logger

    • "GoogleUtilities/NSData+zlib"

    • GoogleUtilities/Reachability

  • "GoogleUtilities/NSData+zlib (6.5.2)"
  • GoogleUtilities/Reachability (6.5.2):

    • GoogleUtilities/Logger

  • GoogleUtilities/UserDefaults (6.5.2):

    • GoogleUtilities/Logger

  • GoogleUtilitiesLegacy (1.3.2):

    • GoogleSymbolUtilities (~> 1.1)

  • nanopb (0.3.9011):

    • nanopb/decode (= 0.3.9011)

    • nanopb/encode (= 0.3.9011)

  • nanopb/decode (0.3.9011)
  • nanopb/encode (0.3.9011)
  • ObjcExceptionBridging (1.0.1):

    • ObjcExceptionBridging/ObjcExceptionBridging (= 1.0.1)

  • ObjcExceptionBridging/ObjcExceptionBridging (1.0.1)
  • Protobuf (3.11.4)
  • Result (4.1.0)

I re-released with Xcode 11.3.1 and an updated Firebase. The crashes have stopped. I鈥檓 not sure which solution was the actual fix. I ordered an iPad 2 to investigate more.

Sent with GitHawk

I'm just preparing a new release with Xcode 11.3.1 -- I strongly suspect that this is the "fix" here because my previous release had the exact same SDK versions and didn't have these crashes. Only difference for me was the Xcode version.

Glad it worked for you, that's promising at least!

I am also facing this issue since I updated to XCode 11.4.
I am using Core Data with an SQLite store in my app.
The issue also persists after updating the pods to the latest versions.
It seems the crashes are only appearing on 32 bit devices with low memory remaining.
A colleague has an iPad 3 with iOS 9 and can reproduce the crashes. Unfortunately I don't have access to this device atm due to home office.

PODS:

  • Crashlytics (3.14.0):

    • Fabric (~> 1.10.2)

  • Fabric (1.10.2)
  • Firebase/Analytics (6.21.0):

    • Firebase/Core

  • Firebase/Core (6.21.0):

    • Firebase/CoreOnly

    • FirebaseAnalytics (= 6.4.0)

  • Firebase/CoreOnly (6.21.0):

    • FirebaseCore (= 6.6.5)

  • FirebaseAnalytics (6.4.0):

    • FirebaseCore (~> 6.6)

    • FirebaseInstallations (~> 1.1)

    • GoogleAppMeasurement (= 6.4.0)

    • GoogleUtilities/AppDelegateSwizzler (~> 6.0)

    • GoogleUtilities/MethodSwizzler (~> 6.0)

    • GoogleUtilities/Network (~> 6.0)

    • "GoogleUtilities/NSData+zlib (~> 6.0)"

    • nanopb (= 0.3.9011)

  • FirebaseCore (6.6.5):

    • FirebaseCoreDiagnostics (~> 1.2)

    • FirebaseCoreDiagnosticsInterop (~> 1.2)

    • GoogleUtilities/Environment (~> 6.5)

    • GoogleUtilities/Logger (~> 6.5)

  • FirebaseCoreDiagnostics (1.2.2):

    • FirebaseCoreDiagnosticsInterop (~> 1.2)

    • GoogleDataTransportCCTSupport (~> 2.0)

    • GoogleUtilities/Environment (~> 6.5)

    • GoogleUtilities/Logger (~> 6.5)

    • nanopb (~> 0.3.901)

  • FirebaseCoreDiagnosticsInterop (1.2.0)
  • FirebaseInstallations (1.1.1):

    • FirebaseCore (~> 6.6)

    • GoogleUtilities/UserDefaults (~> 6.5)

    • PromisesObjC (~> 1.2)

  • GoogleAppMeasurement (6.4.0):

    • GoogleUtilities/AppDelegateSwizzler (~> 6.0)

    • GoogleUtilities/MethodSwizzler (~> 6.0)

    • GoogleUtilities/Network (~> 6.0)

    • "GoogleUtilities/NSData+zlib (~> 6.0)"

    • nanopb (= 0.3.9011)

  • GoogleDataTransport (5.1.0)
  • GoogleDataTransportCCTSupport (2.0.1):

    • GoogleDataTransport (~> 5.1)

    • nanopb (~> 0.3.901)

  • GoogleUtilities/AppDelegateSwizzler (6.5.2):

    • GoogleUtilities/Environment

    • GoogleUtilities/Logger

    • GoogleUtilities/Network

  • GoogleUtilities/Environment (6.5.2)
  • GoogleUtilities/Logger (6.5.2):

    • GoogleUtilities/Environment

  • GoogleUtilities/MethodSwizzler (6.5.2):

    • GoogleUtilities/Logger

  • GoogleUtilities/Network (6.5.2):

    • GoogleUtilities/Logger

    • "GoogleUtilities/NSData+zlib"

    • GoogleUtilities/Reachability

  • "GoogleUtilities/NSData+zlib (6.5.2)"
  • GoogleUtilities/Reachability (6.5.2):

    • GoogleUtilities/Logger

  • GoogleUtilities/UserDefaults (6.5.2):

    • GoogleUtilities/Logger

  • HTMLString (5.0.0)
  • libxlsxwriter (0.9.4)
  • nanopb (0.3.9011):

    • nanopb/decode (= 0.3.9011)

    • nanopb/encode (= 0.3.9011)

  • nanopb/decode (0.3.9011)
  • nanopb/encode (0.3.9011)
  • PromisesObjC (1.2.8)
  • Starscream (3.0.6)

I鈥檓 suspecting a compiler bug. If it helps, Firebase wasn鈥檛 the only library crashing. I was also getting a lot of crashes in the Branch SDK, which doesn鈥檛 user SQLite. This method was crashing a lot. This and the Firebase crashes would happen to users immediately after opening the app, even after restarting the device.

com.apple.root.default-qos
0  libsystem_kernel.dylib         0x24272920 semaphore_wait_trap + 8
1  libsystem_platform.dylib       0x243273a5 _os_semaphore_wait + 12
2  libdispatch.dylib              0x24179b9f _dispatch_sync_f_slow + 230
3  libdispatch.dylib              0x241726d9 dispatch_sync_f$VARIANT$mp + 108
4  Scribble                       0x1fd98d -[Branch getLatestReferringParamsSynchronous] + 1425 (Branch.m:14

Sent with GitHawk

@bridger I have the same situation with same version of GA and crash only on the Xcode11.4 release. So it should be Xcode trigger the issue. But I don't have 32bit device and just tried to release a new version that compiled by Xcode 11.3.1 today. So 馃

I'm fairly certain that the issue is not with Firebase. Today I got an iPad 2 for testing and I see crashes in Swift's metadata lookup code. I'm going to move to this thread in the Swift forums https://forums.swift.org/t/crashes-on-32-bit-after-xcode-11-4/35035

@bridger Thanks for sharing. Hopefully Apple will provide some feedback!

Unfortunately the crashes seem to persist when built with the new Xcode version 11.4.1

->  0x4638de0: andeq  r0, r0, r0
    0x4638de4: andeq  r0, r0, r2
    0x4638de8: .long  0x06e03c30                ; unknown opcode
    0x4638dec: andeq  r0, r0, r1
    0x4638df0: strbteq r0, [r10], r5, lsr #7
    0x4638df4: .long  0x062fff38                ; unknown opcode
    0x4638df8: .long  0x062fff38                ; unknown opcode
    0x4638dfc: .long  0x0147a294                ; unknown opcode

... and similar crashes in (real) iPhone 5 @ iOS10.3.3 only when SWIFT_OPTIMIZATION_LEVEL = "-O"; is applied to both Debug and Production builds.

This radar seems to be relevant:
https://bugs.swift.org/browse/SR-12511

From the Xcode 11.5 Beta release notes: _Fixed an issue with incorrect code generation when targeting armv7 devices. (61901594)_

Going to mark this resolved by avoiding Xcode 11.4 with either earlier or later Xcode versions.

Was this page helpful?
0 / 5 - 0 ratings