Skip to content

FirebaseMessaging can't open database, probably because of "Data Protection" capability. #401

Closed
@antranapp

Description

@antranapp

[READ] Step 1: Are you in the right place?

Yes, we have a lot of crashes in Fabric now

[REQUIRED] Step 2: Describe your environment

  • Xcode version: 9.0.1
  • Firebase SDK version: 4.3.0
  • Firebase Component: Messaging
  • Component version: 4.3.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

We have just upgraded Firebase SDK in our app from version 3.9.0 to 4.3.0 and now seeing a lot of crashes in fabric. Below is crash report:

#0. Crashed: com.apple.main-thread
0  xxxxxxx                        0x1045b6a08 -[FIRMessagingRmq2PersistentStore openDatabase:] + 4347505160
1  xxxxxxx                        0x1045b5d1c -[FIRMessagingRmq2PersistentStore initWithDatabaseName:] + 4347501852
2  xxxxxxx                        0x1045b8718 -[FIRMessagingRmqManager initWithDatabaseName:] + 4347512600
3  xxxxxxx                        0x10459fd54 -[FIRMessaging setupRmqManager] + 4347411796
4  xxxxxxx                        0x10459f6f0 -[FIRMessaging start] + 4347410160
5  xxxxxxx                        0x10459f3d4 __25+[FIRMessaging messaging]_block_invoke + 4347409364
6  libswiftCoreData.dylib         0x185a2d048 (Missing)
7  libswiftCoreData.dylib         0x185a30710 (Missing)
8  xxxxxxx                        0x10459f358 +[FIRMessaging messaging] + 4347409240
9  xxxxxxx                        0x10459ed44 +[FIRMessaging(FIRApp) didReceiveConfigureSDKNotification:] + 4347407684
10 libswiftCoreData.dylib         0x18603a12c (Missing)
11 libswiftCoreData.dylib         0x1860396cc (Missing)
12 libswiftCoreData.dylib         0x186039430 (Missing)
13 libswiftCoreData.dylib         0x1860b69f4 (Missing)
14 libswiftCoreData.dylib         0x185f703e0 (Missing)
15 libswiftCoreData.dylib         0x186990498 (Missing)
16 xxxxxxx                        0x10457b58c +[FIRApp sendNotificationsToSDKs:] + 4347262348
17 xxxxxxx                        0x10457a52c +[FIRApp configureDefaultAppWithOptions:sendingNotifications:] + 4347258156
18 xxxxxxx                        0x10457a250 +[FIRApp configureWithOptions:] + 4347257424
19 xxxxxxx                        0x104374938 specialized static BaseAppManager.initializeFirebase() (BaseAppManager.swift:389)
20 xxxxxxx                        0x10436d900 BaseAppManager.init() (AppManagerDE.swift:141)
21 xxxxxxx                        0x1044539fc AppManager.init() (AppManagerDE.swift:25)
22 xxxxxxx                        0x10431f6a8 AppDelegate.init() (AppDelegate.swift:27)
23 xxxxxxx                        0x10431f968 @objc AppDelegate.init() (AppDelegate.swift)
24 UIKit                          0x18f721328 _UIApplicationMainPreparations + 1636
25 UIKit                          0x18f51b84c UIApplicationMain + 156
26 xxxxxxx                        0x1042ecd50 main (AppDelegate.swift:12)
27 libswiftCoreData.dylib         0x185a9256c (Missing)

--

#0. Crashed: com.apple.main-thread
0  xxxxxxx                        0x1045b6a08 -[FIRMessagingRmq2PersistentStore openDatabase:] + 4347505160
1  xxxxxxx                        0x1045b5d1c -[FIRMessagingRmq2PersistentStore initWithDatabaseName:] + 4347501852
2  xxxxxxx                        0x1045b8718 -[FIRMessagingRmqManager initWithDatabaseName:] + 4347512600
3  xxxxxxx                        0x10459fd54 -[FIRMessaging setupRmqManager] + 4347411796
4  xxxxxxx                        0x10459f6f0 -[FIRMessaging start] + 4347410160
5  xxxxxxx                        0x10459f3d4 __25+[FIRMessaging messaging]_block_invoke + 4347409364
6  libswiftCoreData.dylib         0x185a2d048 (Missing)
7  libswiftCoreData.dylib         0x185a30710 (Missing)
8  xxxxxxx                        0x10459f358 +[FIRMessaging messaging] + 4347409240
9  xxxxxxx                        0x10459ed44 +[FIRMessaging(FIRApp) didReceiveConfigureSDKNotification:] + 4347407684
10 libswiftCoreData.dylib         0x18603a12c (Missing)
11 libswiftCoreData.dylib         0x1860396cc (Missing)
12 libswiftCoreData.dylib         0x186039430 (Missing)
13 libswiftCoreData.dylib         0x1860b69f4 (Missing)
14 libswiftCoreData.dylib         0x185f703e0 (Missing)
15 libswiftCoreData.dylib         0x186990498 (Missing)
16 xxxxxxx                        0x10457b58c +[FIRApp sendNotificationsToSDKs:] + 4347262348
17 xxxxxxx                        0x10457a52c +[FIRApp configureDefaultAppWithOptions:sendingNotifications:] + 4347258156
18 xxxxxxx                        0x10457a250 +[FIRApp configureWithOptions:] + 4347257424
19 xxxxxxx                        0x104374938 specialized static BaseAppManager.initializeFirebase() (BaseAppManager.swift:389)
20 xxxxxxx                        0x10436d900 BaseAppManager.init() (AppManagerDE.swift:141)
21 xxxxxxx                        0x1044539fc AppManager.init() (AppManagerDE.swift:25)
22 xxxxxxx                        0x10431f6a8 AppDelegate.init() (AppDelegate.swift:27)
23 xxxxxxx                        0x10431f968 @objc AppDelegate.init() (AppDelegate.swift)
24 UIKit                          0x18f721328 _UIApplicationMainPreparations + 1636
25 UIKit                          0x18f51b84c UIApplicationMain + 156
26 xxxxxxx                        0x1042ecd50 main (AppDelegate.swift:12)
27 libswiftCoreData.dylib         0x185a9256c (Missing)

#1. Thread
0  libswiftCoreData.dylib         0x185cd2c2c (Missing)

#2. Thread
0  libswiftCoreData.dylib         0x185cd2c2c (Missing)

#3. com.twitter.crashlytics.ios.binary-images
0  libswiftCoreData.dylib         0x185ba2670 (Missing)
1  xxxxxxx                        0x1044ec294 __CLSFileWriteWithRetries_block_invoke + 4346675860
2  xxxxxxx                        0x1044ec1d4 CLSFileLoopWithWriteBlock + 4346675668
3  xxxxxxx                        0x1044ec484 CLSFileWriteToFileDescriptorOrBuffer + 4346676356
4  xxxxxxx                        0x1044ec79c CLSFileWriteCollectionEnd + 4346677148
5  xxxxxxx                        0x1044d4e08 __CLSBinaryImageChanged_block_invoke + 4346580488
6  libswiftCoreData.dylib         0x185a2d088 (Missing)
7  libswiftCoreData.dylib         0x185a2d048 (Missing)
8  libswiftCoreData.dylib         0x185a36e48 (Missing)
9  libswiftCoreData.dylib         0x185a377d8 (Missing)
10 libswiftCoreData.dylib         0x185a38200 (Missing)
11 libswiftCoreData.dylib         0x185a404a0 (Missing)
12 libswiftCoreData.dylib         0x185cd2fe0 (Missing)
13 libswiftCoreData.dylib         0x185cd2c30 (Missing)

#4. com.apple.uikit.eventfetch-thread
0  libswiftCoreData.dylib         0x185ba0bc4 (Missing)
1  libswiftCoreData.dylib         0x185ba0a3c (Missing)
2  libswiftCoreData.dylib         0x18604fce4 (Missing)
3  libswiftCoreData.dylib         0x18604d8b0 (Missing)
4  libswiftCoreData.dylib         0x185f6e2d8 (Missing)
5  libswiftCoreData.dylib         0x1869966e4 (Missing)
6  libswiftCoreData.dylib         0x1869b5afc (Missing)
7  UIKit                          0x19006702c -[UIEventFetcher threadMain] + 136
8  libswiftCoreData.dylib         0x186a97860 (Missing)
9  libswiftCoreData.dylib         0x185cd432c (Missing)
10 libswiftCoreData.dylib         0x185cd41f8 (Missing)
11 libswiftCoreData.dylib         0x185cd2c38 (Missing)

#5. SCNetworkReachability.callback
0  libswiftCoreData.dylib         0x185cce904 (Missing)
1  libswiftCoreData.dylib         0x185c08c1c (Missing)
2  libswiftCoreData.dylib         0x185c07ce0 (Missing)
3  libswiftCoreData.dylib         0x185bf94f0 (Missing)
4  libswiftCoreData.dylib         0x185bf9424 (Missing)
5  libswiftCoreData.dylib         0x1855c845c (Missing)
6  libswiftCoreData.dylib         0x185a2d0c0 (Missing)
7  libswiftCoreData.dylib         0x185d0f6a4 (Missing)
8  libswiftCoreData.dylib         0x185c5444c (Missing)
9  libswiftCoreData.dylib         0x185c6a968 (Missing)
10 libswiftCoreData.dylib         0x185c6a780 (Missing)
11 libswiftCoreData.dylib         0x186d975ec (Missing)
12 libswiftCoreData.dylib         0x185d0ee64 (Missing)
13 libswiftCoreData.dylib         0x185c67554 (Missing)
14 libswiftCoreData.dylib         0x186d97480 (Missing)
15 libswiftCoreData.dylib         0x185c63fdc (Missing)
16 libswiftCoreData.dylib         0x185a2d088 (Missing)
17 libswiftCoreData.dylib         0x185a2d048 (Missing)
18 libswiftCoreData.dylib         0x185a36e48 (Missing)
19 libswiftCoreData.dylib         0x185a377d8 (Missing)
20 libswiftCoreData.dylib         0x185a38200 (Missing)
21 libswiftCoreData.dylib         0x185a404a0 (Missing)
22 libswiftCoreData.dylib         0x185cd2fe0 (Missing)
23 libswiftCoreData.dylib         0x185cd2c30 (Missing)

#6. Thread
0  libswiftCoreData.dylib         0x185cd2c2c (Missing)

#7. com.twitter.crashlytics.ios.MachExceptionServer
0  xxxxxxx                        0x1044ed8ac CLSProcessRecordAllThreads + 4346681516
1  xxxxxxx                        0x1044ed8ac CLSProcessRecordAllThreads + 4346681516
2  xxxxxxx                        0x1044ed768 CLSProcessRecordAllThreads + 4346681192
3  xxxxxxx                        0x1044dd894 CLSHandler + 4346615956
4  xxxxxxx                        0x1044d88a8 CLSMachExceptionServer + 4346595496
5  libswiftCoreData.dylib         0x185cd432c (Missing)
6  libswiftCoreData.dylib         0x185cd41f8 (Missing)
7  libswiftCoreData.dylib         0x185cd2c38 (Missing)

#8. com.apple.NSURLConnectionLoader
0  libswiftCoreData.dylib         0x185ba0bc4 (Missing)
1  libswiftCoreData.dylib         0x185ba0a3c (Missing)
2  libswiftCoreData.dylib         0x18604fce4 (Missing)
3  libswiftCoreData.dylib         0x18604d8b0 (Missing)
4  libswiftCoreData.dylib         0x185f6e2d8 (Missing)
5  libswiftCoreData.dylib         0x1866d7b40 (Missing)
6  libswiftCoreData.dylib         0x186a97860 (Missing)
7  libswiftCoreData.dylib         0x185cd432c (Missing)
8  libswiftCoreData.dylib         0x185cd41f8 (Missing)
9  libswiftCoreData.dylib         0x185cd2c38 (Missing)

#9. Thread
0  libswiftCoreData.dylib         0x185cd2c2c (Missing)

#10. Thread
0  libswiftCoreData.dylib         0x185cd2c2c (Missing)

The crash might be related to #199

Relevant Code:

We just upgrade the Firebase SDK from 3.9.0 to 4.3.0.
We have 3 targets in the workspace which basically have the same code base (and the same version of Firebase SDK). From these 3 targets we build 3 apps targeting different countries.
2 of the 3 targets (says target A and B) don't have such above crash.
Only 1 target (says target C) has currently about 1.1 million such above crashes in Fabric.

The difference of target C to target A & B is that it uses CoreLocation for background location tracking. All of our targets have also "Data Protection" Capability enabled. We suspect that the app is awaken in the background and because of "Data Protection", firebase can't open/create the database in the desired place.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions