firebase-ios-sdk: App crashes on [APMSqliteStore executeSQLStatement:error:] with _os_unfair_lock_unowned_abort (b/171430214)

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 11.4.1
  • Firebase SDK version: 6.23.0. Using following POD declaration pod Firebase/Crashlytics pod Firebase/Analytics
  • Firebase Component: FirebaseCrashlytics FirebaseAnalytics
  • Component version: FirebaseCrashlytics (4.0.0) FirebaseAnalytics (6.4.2)
  • Installation method: CocoaPods

[REQUIRED] Step 2: Describe the problem

We have integrated Firebase Crashlytics in our iOS app. We are getting crashes on Firebase console which has reference to Firebase SDK. Please look at the following crash report crashReport.txt

Steps to reproduce:

We are not able to reproduce it. We are getting it on Firebase Crashlytics console

Relevant Code:

Don’t know what causing this crash

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 33 (11 by maintainers)

Most upvoted comments

We are also experiencing this crash on 7.11. It’s currently our most commonly occurring crash. 😔

@paulb777 @maksymmalyhin We ran into the same problem,We used SDK version 7.6.0

Podfile

   pod 'Firebase/Core', '7.6.0', :inhibit_warnings => true
   pod 'Firebase/Performance', '7.6.0', :inhibit_warnings => true
   pod 'FirebaseCrashlytics', '7.6.0', :inhibit_warnings => true
   pod 'FirebaseRemoteConfig', '7.6.0', :inhibit_warnings

Podfile.lock

  - Firebase/Core (7.6.0):
    - Firebase/CoreOnly
    - FirebaseAnalytics (= 7.6.0)
  - Firebase/CoreOnly (7.6.0):
    - FirebaseCore (= 7.6.0)
  - Firebase/Performance (7.6.0):
    - Firebase/CoreOnly
    - FirebasePerformance (~> 7.6.0)
  - FirebaseABTesting (7.6.0):
    - FirebaseCore (~> 7.0)
  - FirebaseAnalytics (7.6.0):
    - FirebaseCore (~> 7.0)
    - FirebaseInstallations (~> 7.0)
    - GoogleAppMeasurement (= 7.6.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.0)
    - GoogleUtilities/MethodSwizzler (~> 7.0)
    - GoogleUtilities/Network (~> 7.0)
    - "GoogleUtilities/NSData+zlib (~> 7.0)"
    - nanopb (~> 2.30907.0)
  - FirebaseCore (7.6.0):
    - FirebaseCoreDiagnostics (~> 7.4)
    - GoogleUtilities/Environment (~> 7.0)
    - GoogleUtilities/Logger (~> 7.0)
  - FirebaseCoreDiagnostics (7.6.0):
    - GoogleDataTransport (~> 8.0)
    - GoogleUtilities/Environment (~> 7.0)
    - GoogleUtilities/Logger (~> 7.0)
    - nanopb (~> 2.30907.0)
  - FirebaseCrashlytics (7.6.0):
    - FirebaseCore (~> 7.0)
    - FirebaseInstallations (~> 7.0)
    - GoogleDataTransport (~> 8.0)
    - nanopb (~> 2.30907.0)
    - PromisesObjC (~> 1.2)
  - FirebaseInstallations (7.0.0):
    - FirebaseCore (~> 7.0)
    - GoogleUtilities/Environment (~> 7.0)
    - GoogleUtilities/UserDefaults (~> 7.0)
    - PromisesObjC (~> 1.2)
  - FirebasePerformance (7.6.0):
    - FirebaseCore (~> 7.0)
    - FirebaseInstallations (~> 7.0)
    - FirebaseRemoteConfig (~> 7.0)
    - GoogleDataTransport (~> 8.2)
    - GoogleUtilities/Environment (~> 7.0)
    - GoogleUtilities/ISASwizzler (~> 7.0)
    - GoogleUtilities/MethodSwizzler (~> 7.0)
    - Protobuf (~> 3.12)
  - FirebaseRemoteConfig (7.6.0):
    - FirebaseABTesting (~> 7.0)
    - FirebaseCore (~> 7.0)
    - FirebaseInstallations (~> 7.0)
    - GoogleUtilities/Environment (~> 7.0)
    - "GoogleUtilities/NSData+zlib (~> 7.0)"

Stack trace

Crashed: com.google.fira.worker
0  libsystem_platform.dylib       0x1ea25fda0 _os_unfair_lock_unowned_abort + 36
1  libsystem_platform.dylib       0x1ea25ca64 _os_unfair_lock_unlock_slow + 132
2  libsqlite3.dylib               0x1bab3456c sqlite3_snprintf + 4128
3  libsqlite3.dylib               0x1bab34060 sqlite3_snprintf + 2836
4  libsqlite3.dylib               0x1bab95458 sqlite3_free_table + 47776
5  libsqlite3.dylib               0x1babf327c sqlite3_sourceid + 86372
6  libsqlite3.dylib               0x1babf2c60 sqlite3_sourceid + 84808
7  libsqlite3.dylib               0x1bab97f48 sqlite3_free_table + 58768
8  libsqlite3.dylib               0x1bab76d70 sqlite3_step + 35256
9  libsqlite3.dylib               0x1bab6e4f0 sqlite3_step + 312
10 putong                         0x1058408d0 -[APMSqliteStore executeSQLStatement:error:] + 25947000
11 putong                         0x10583ef90 -[APMSqliteStore updateRecord:inTableWithName:columnName:columnValue:error:] + 25940536
12 putong                         0x1057ddb30 -[APMDatabase updateDataType:inTableWithName:columnName:columnValue:error:] + 25542104
13 putong                         0x1057d29d4 -[APMDatabase updateDailyCounts:error:] + 25496700
14 putong                         0x105801ed0 __49-[APMMeasurement(Event) writeEventOnWorkerQueue:]_block_invoke + 25690488
15 putong                         0x105840114 -[APMSqliteStore performTransactionWithError:block:] + 25945020
16 putong                         0x1057d1a68 -[APMDatabase performTransaction:] + 25492752
17 putong                         0x105801cc0 -[APMMeasurement(Event) writeEventOnWorkerQueue:] + 25689960
18 putong                         0x10580181c -[APMMeasurement(Event) handleEventOnWorkerQueue:] + 25688772
19 putong                         0x10580fc5c -[APMMeasurement logEventOnWorkerQueue:notifyEventListeners:] + 25747204
20 putong                         0x10580fc0c -[APMMeasurement logEventOnWorkerQueueWithOrigin:isPublicEvent:name:parameters:timestamp:enabled:ignoreEnabled:ignoreInterceptor:interceptor:addedScreenParameters:] + 25747124
21 putong                         0x10580f8e8 __151-[APMMeasurement logEventWithOrigin:isPublicEvent:name:parameters:timestamp:enabled:ignoreEnabled:ignoreInterceptor:interceptor:addedScreenParameters:]_block_invoke + 25746320
22 putong                         0x105834bfc __51-[APMScheduler scheduleOnWorkerQueueBlockID:block:]_block_invoke + 25898660
23 libdispatch.dylib              0x1a1771298 _dispatch_call_block_and_release + 24
24 libdispatch.dylib              0x1a1772280 _dispatch_client_callout + 16
25 libdispatch.dylib              0x1a171adcc _dispatch_lane_serial_drain$VARIANT$mp + 612
26 libdispatch.dylib              0x1a171b8a8 _dispatch_lane_invoke$VARIANT$mp + 424
27 libdispatch.dylib              0x1a1725338 _dispatch_workloop_worker_thread + 712
28 libsystem_pthread.dylib        0x1ea26f5a4 _pthread_wqthread + 272
29 libsystem_pthread.dylib        0x1ea272874 start_wqthread + 8

Has happened hundreds of times in the app

We ran into the same issue on SDK ~v7.11~ v8.1.1 It is our number one crash. 😦

Podfile.lock

- Firebase/Analytics (7.11.0):
    - Firebase/Core
  - Firebase/Auth (7.11.0):
    - Firebase/CoreOnly
    - FirebaseAuth (~> 7.11.0)
  - Firebase/Core (7.11.0):
    - Firebase/CoreOnly
    - FirebaseAnalytics (~> 7.11.0)
  - Firebase/CoreOnly (7.11.0):
    - FirebaseCore (= 7.11.0)
  - Firebase/Crashlytics (7.11.0):
    - Firebase/CoreOnly
    - FirebaseCrashlytics (~> 7.11.0)
  - Firebase/RemoteConfig (7.11.0):
    - Firebase/CoreOnly
    - FirebaseRemoteConfig (~> 7.11.0)
  - FirebaseABTesting (7.11.0):
    - FirebaseCore (~> 7.0)
  - FirebaseAnalytics (7.11.0):
    - FirebaseAnalytics/AdIdSupport (= 7.11.0)
    - FirebaseCore (~> 7.0)
    - FirebaseInstallations (~> 7.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.0)
    - GoogleUtilities/MethodSwizzler (~> 7.0)
    - GoogleUtilities/Network (~> 7.0)
    - "GoogleUtilities/NSData+zlib (~> 7.0)"
    - nanopb (~> 2.30908.0)
  - FirebaseAnalytics/AdIdSupport (7.11.0):
    - FirebaseAnalytics/Base (= 7.11.0)
    - FirebaseCore (~> 7.0)
    - FirebaseInstallations (~> 7.0)
    - GoogleAppMeasurement/AdIdSupport (= 7.11.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.0)
    - GoogleUtilities/MethodSwizzler (~> 7.0)
    - GoogleUtilities/Network (~> 7.0)
    - "GoogleUtilities/NSData+zlib (~> 7.0)"
    - nanopb (~> 2.30908.0)
  - FirebaseAnalytics/Base (7.11.0):
    - FirebaseCore (~> 7.0)
    - FirebaseInstallations (~> 7.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.0)
    - GoogleUtilities/MethodSwizzler (~> 7.0)
    - GoogleUtilities/Network (~> 7.0)
    - "GoogleUtilities/NSData+zlib (~> 7.0)"
    - nanopb (~> 2.30908.0)
  - FirebaseAuth (7.11.0):
    - FirebaseCore (~> 7.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.0)
    - GoogleUtilities/Environment (~> 7.0)
    - GTMSessionFetcher/Core (~> 1.4)
  - FirebaseCore (7.11.0):
    - FirebaseCoreDiagnostics (~> 7.4)
    - GoogleUtilities/Environment (~> 7.0)
    - GoogleUtilities/Logger (~> 7.0)
  - FirebaseCoreDiagnostics (7.11.0):
    - GoogleDataTransport (~> 8.4)
    - GoogleUtilities/Environment (~> 7.0)
    - GoogleUtilities/Logger (~> 7.0)
    - nanopb (~> 2.30908.0)
  - FirebaseCrashlytics (7.11.0):
    - FirebaseCore (~> 7.0)
    - FirebaseInstallations (~> 7.0)
    - GoogleDataTransport (~> 8.4)
    - nanopb (~> 2.30908.0)
    - PromisesObjC (~> 1.2)
  - FirebaseInstallations (7.11.0):
    - FirebaseCore (~> 7.0)
    - GoogleUtilities/Environment (~> 7.0)
    - GoogleUtilities/UserDefaults (~> 7.0)
    - PromisesObjC (~> 1.2)
  - FirebaseRemoteConfig (7.11.0):
    - FirebaseABTesting (~> 7.0)
    - FirebaseCore (~> 7.0)
    - FirebaseInstallations (~> 7.0)
    - GoogleUtilities/Environment (~> 7.0)
    - "GoogleUtilities/NSData+zlib (~> 7.0)"

Stack trace

Crashed: APMExperimentWorkerQueue
0  libsystem_platform.dylib       0x1eec96da0 _os_unfair_lock_unowned_abort + 36
1  libsystem_platform.dylib       0x1eec94f78 _os_unfair_lock_unlock_slow + 132
2  libsqlite3.dylib               0x1bf53c56c sqlite3_snprintf + 4128
3  libsqlite3.dylib               0x1bf53c060 sqlite3_snprintf + 2836
4  libsqlite3.dylib               0x1bf59d458 sqlite3_free_table + 47776
5  libsqlite3.dylib               0x1bf591bc4 sqlite3_free_table + 524
6  libsqlite3.dylib               0x1bf55951c sqlite3_finalize + 7284
7  libsqlite3.dylib               0x1bf57895c sqlite3_step + 9636
8  libsqlite3.dylib               0x1bf5764f0 sqlite3_step + 312
9  app                            0x100b395e8 -[APMSqliteStore executeSQLStatement:error:] + 2389572
10 app                            0x100b39558 -[APMSqliteStore executeSQL:error:] + 2389428
11 app                            0x100b36934 -[APMSqliteStore ensureTableWithName:createSQL:requiredColumnNames:addOnColumns:error:] + 2378128
12 app                            0x100b35c48 -[APMSqliteStore ensureTableWithName:elementaryColumnInfo:addOnColumnInfo:error:] + 2374820
13 app                            0x100b364bc -[APMSqliteStore ensureTableWithName:elementaryColumnInfo:addOnColumnInfo:modifyColumnInfo:error:] + 2376984
14 app                            0x100ad9738 -[APMEDatabase ensureAllTables] + 1996692
15 app                            0x100ad92b4 -[APMEDatabase initializeDatabaseResourcesWithContext:databasePath:] + 1995536
16 app                            0x100ad9190 -[APMEDatabase initWithPath:] + 1995244
17 app                            0x100ae2094 -[APMETaskManager startTaskManagerOnWorkerQueue] + 2031856
18 app                            0x100ae203c __35-[APMETaskManager startTaskManager]_block_invoke + 2031768
19 app                            0x100ae35ac __46-[APMETaskManager dispatchAsyncOnWorkerQueue:]_block_invoke + 2037256
20 libdispatch.dylib              0x1a614d298 _dispatch_call_block_and_release + 24
21 libdispatch.dylib              0x1a614e280 _dispatch_client_callout + 16
22 libdispatch.dylib              0x1a612a4f0 _dispatch_lane_serial_drain$VARIANT$armv81 + 568
23 libdispatch.dylib              0x1a612afdc _dispatch_lane_invoke$VARIANT$armv81 + 404
24 libdispatch.dylib              0x1a6134800 _dispatch_workloop_worker_thread + 692
25 libsystem_pthread.dylib        0x1eeca55a4 _pthread_wqthread + 272
26 libsystem_pthread.dylib        0x1eeca8874 start_wqthread + 8

@taschik We were able to work around this issue though I can’t say it was easy - I found this comment https://github.com/firebase/firebase-ios-sdk/issues/8024#issuecomment-860848817 Basically, it sounds like it’s caused by a conflict with sharing SQLite amongst Firebase and other code/SDKs that don’t clean up after themselves properly.

I referred the comment to one of our third party SDK providers and they were able to make the same code change mentioned in there, and that fixed the crashes (no updates to Firebase). It sounds like Firebase being mentioned in the crash logs is actually a red herring.

So basically, I had a punt as to which third party SDKs might be using SQLite, and sent them a “hail Mary” bug report which actually worked. Sorry I don’t have a more definitive workaround.

It’s getting to the point where I’m actively looking to rip out Firebase Remote Config because of the unacceptably high crash rate.

More than 20% of customers upgraded and not a single crash so far. I am afraid there is a serious issue in 6.34.0 because with that i had 10s of crashes in a day and in random places having “APMSqliteStore” stuff in common 😦

Same problem, had to rollback also…

Crashed: com.google.fira.worker 0 libsystem_platform.dylib 0x1e9828dc0 _os_unfair_lock_unowned_abort + 36 1 libsystem_platform.dylib 0x1e9826f94 _os_unfair_lock_unlock_slow + 132 2 libsqlite3.dylib 0x1bc2064e4 sqlite3_snprintf + 4128 3 libsqlite3.dylib 0x1bc205fd8 sqlite3_snprintf + 2836 4 libsqlite3.dylib 0x1bc2673d4 sqlite3_free_table + 47776 5 libsqlite3.dylib 0x1bc2c527c sqlite3_sourceid + 86368 6 libsqlite3.dylib 0x1bc2c4c60 sqlite3_sourceid + 84804 7 libsqlite3.dylib 0x1bc269f4c sqlite3_free_table + 58904 8 libsqlite3.dylib 0x1bc248cec sqlite3_step + 35256 9 libsqlite3.dylib 0x1bc24046c sqlite3_step + 312 10 xxxx 0x10438422c -[APMSqliteStore executeSQLStatement:error:] + 4303716908 11 xxxxx 0x104382898 -[APMSqliteStore updateRecord:inTableWithName:columnName:columnValue:error:] + 4303710360 12 xxxxx 0x10434c99c -[APMDatabase updateDataType:inTableWithName:columnName:columnValue:error:] + 4303489436 13 xxxxx 0x104341158 -[APMDatabase updateDailyCounts:error:] + 4303442264 14 xxxxx 0x10435a57c __42-[APMMeasurement writeEventOnWorkerQueue:]_block_invoke.1277 + 4303545724 15 xxxxx 0x104383a60 -[APMSqliteStore performTransactionWithError:block:] + 4303714912 16 xxxxx 0x1043401a4 -[APMDatabase performTransaction:] + 4303438244 17 xxxxx 0x10435980c -[APMMeasurement writeEventOnWorkerQueue:] + 4303542284 18 xxxxx 0x104358f7c -[APMMeasurement handleEventOnWorkerQueue:] + 4303540092 19 xxxxxx 0x1043581fc __27-[APMMeasurement logEvent:]_block_invoke + 4303536636 20 xxxxx 0x10436db48 __51-[APMScheduler scheduleOnWorkerQueueBlockID:block:]_block_invoke + 4303625032 21 libdispatch.dylib 0x1a3c1d298 _dispatch_call_block_and_release + 24 22 libdispatch.dylib 0x1a3c1e280 _dispatch_client_callout + 16 23 libdispatch.dylib 0x1a3bfa4fc _dispatch_lane_serial_drain$VARIANT$armv81 + 568 24 libdispatch.dylib 0x1a3bfafe8 _dispatch_lane_invoke$VARIANT$armv81 + 404 25 libdispatch.dylib 0x1a3c04808 _dispatch_workloop_worker_thread + 692 26 libsystem_pthread.dylib 0x1e98385a4 _pthread_wqthread + 272 27 libsystem_pthread.dylib 0x1e983b874 start_wqthread + 8