firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

[FIRApp configure] crashes app when running in xcode 9

Open liuzhen2008 opened this issue 9 years ago • 16 comments

Stack trace below.

The stacktrace occurs whenever i run my app through xcode [FIRApp configure] is executed in the didFinishLaunchingWithOptions

Thread 14: EXC_BAD_ACCESS (code=1, address=0xfff8000000080000)

#0	0x0000000184599bd8 in _platform_memmove ()
#1	0x0000000184414e78 in __memcpy_chk ()
#2	0x0000000184414e78 in __memcpy_chk ()
#3	0x0000000105bb9e28 in pb_field_set_to_default at /Users/liuzhen/Documents/CharlyCode/charlyUser/Pods/nanopb/pb_decode.c:808
#4	0x0000000105bb8550 in pb_message_set_to_defaults at /Users/liuzhen/Documents/CharlyCode/charlyUser/Pods/nanopb/pb_decode.c:844
#5	0x0000000105bb84ec in pb_decode at /Users/liuzhen/Documents/CharlyCode/charlyUser/Pods/nanopb/pb_decode.c:958
#6	0x0000000105dfd7b8 in firapb_decode_measurement_config ()
#7	0x0000000105e02444 in -[FIRAPBMeasurementConfig initWithBuffer:] ()
#8	0x0000000105dcb30c in -[FIRADatabase queryMeasurementConfigWithError:] ()
#9	0x0000000105de5f40 in -[FIRARemoteConfig measurementConfigFromDatabase] ()
#10	0x0000000105de46d0 in -[FIRARemoteConfig initWithGMPAppID:database:measurementConfig:] ()
#11	0x0000000105de4440 in -[FIRARemoteConfig initWithGMPAppID:database:] ()
#12	0x0000000105dd2940 in __48-[FIRAMeasurement startMeasurementOnWorkerQueue]_block_invoke ()
#13	0x0000000108a9545c in _dispatch_client_callout ()
#14	0x0000000108a9617c in dispatch_once_f ()
#15	0x0000000105dd2544 in -[FIRAMeasurement startMeasurementOnWorkerQueue] ()
#16	0x0000000105dd2310 in -[FIRAMeasurement setEnabledOnWorkerQueue:] ()
#17	0x0000000105de6c24 in __52-[FIRAScheduler scheduleOnWorkerQueueBlockID:block:]_block_invoke ()
#18	0x0000000108a9549c in _dispatch_call_block_and_release ()
#19	0x0000000108a9545c in _dispatch_client_callout ()
#20	0x0000000108aa4110 in _dispatch_queue_serial_drain ()
#21	0x0000000108a989a4 in _dispatch_queue_invoke ()
#22	0x0000000108aa5104 in _dispatch_root_queue_drain_deferred_wlh ()
#23	0x0000000108aac100 in _dispatch_workloop_worker_thread ()
#24	0x00000001845a2fe0 in _pthread_wqthread ()
#25	0x00000001845a2c30 in start_wqthread ()
Enqueued from FIRAnalyticsQueue (Thread 5) Queue : FIRAnalyticsQueue (serial)
#0	0x0000000108aa4c50 in _dispatch_queue_push ()
#1	0x0000000105de6bc4 in -[FIRAScheduler scheduleOnWorkerQueueBlockID:block:] ()
#2	0x0000000105dd2254 in -[FIRAMeasurement setEnabled:] ()
#3	0x0000000105dd205c in -[FIRAMeasurement initWithDatabaseName:persistedConfig:network:scheduler:alarm:options:] ()
#4	0x0000000105dd1e40 in -[FIRAMeasurement initWithOptions:] ()
#5	0x0000000105dd0e4c in __55+[FIRAMeasurement initializeSharedInstanceWithOptions:]_block_invoke ()
#6	0x0000000108a9545c in _dispatch_client_callout ()
#7	0x0000000108a9617c in dispatch_once_f ()
#8	0x0000000105dd0db8 in +[FIRAMeasurement initializeSharedInstanceWithOptions:] ()
#9	0x0000000105de83c4 in __47+[FIRAnalytics startWithConfiguration:options:]_block_invoke_2 ()
#10	0x0000000108a9549c in _dispatch_call_block_and_release ()
#11	0x0000000108a9545c in _dispatch_client_callout ()
#12	0x0000000108aa4110 in _dispatch_queue_serial_drain ()
#13	0x0000000108a989a4 in _dispatch_queue_invoke ()
#14	0x0000000108aa5104 in _dispatch_root_queue_drain_deferred_wlh ()
#15	0x0000000108aac100 in _dispatch_workloop_worker_thread ()
#16	0x00000001845a2fe0 in _pthread_wqthread ()
#17	0x00000001845a2c30 in start_wqthread ()
Enqueued from com.apple.main-thread (Thread 1) Queue : com.apple.main-thread (serial)
#0	0x0000000108aa4c50 in _dispatch_queue_push ()
#1	0x0000000105de8500 in +[FIRAnalytics dispatchAsyncOnSerialQueue:] ()
#2	0x0000000105de8340 in __47+[FIRAnalytics startWithConfiguration:options:]_block_invoke ()
#3	0x0000000108a9545c in _dispatch_client_callout ()
#4	0x0000000108a9617c in dispatch_once_f ()
#5	0x0000000105de813c in +[FIRAnalytics startWithConfiguration:options:] ()
#6	0x0000000105e09600 in -[FIRApp configureCore] ()
#7	0x0000000105e091d4 in +[FIRApp addAppToAppDictionary:] ()
#8	0x0000000105e08890 in +[FIRApp configureDefaultAppWithOptions:sendingNotifications:] ()
#9	0x0000000105e08554 in +[FIRApp configure] ()
#10	0x00000001050d2cc8 in -[AppDelegate setupFirebase] at /Users/liuzhen/Documents/CharlyCode/charlyUser/charlyUser/AppDelegate.m:122
#11	0x00000001050d2bfc in -[AppDelegate application:didFinishLaunchingWithOptions:] at /Users/liuzhen/Documents/CharlyCode/charlyUser/charlyUser/AppDelegate.m:108
#12	0x000000018ddf7050 in -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] ()
#13	0x000000018dfea898 in -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] ()
#14	0x000000018dfef6e4 in -[UIApplication _runWithMainScene:transitionContext:completion:] ()
#15	0x000000018e27d454 in __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke ()
#16	0x000000018e54d1f0 in +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] ()
#17	0x000000018e27d0b8 in -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] ()
#18	0x000000018e27d928 in -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] ()
#19	0x000000018e9e66e8 in __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke ()
#20	0x000000018e9e658c in -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] ()
#21	0x000000018e7629c0 in __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke ()
#22	0x000000018e8f7fc8 in _performActionsWithDelayForTransitionContext ()
#23	0x000000018e762870 in -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] ()
#24	0x000000018e54c850 in -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] ()
#25	0x000000018dfede28 in -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] ()
#26	0x000000018e3f16ec in -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] ()
#27	0x0000000187019768 in -[FBSSceneImpl _didCreateWithTransitionContext:completion:] ()
#28	0x0000000187022070 in __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 ()
#29	0x0000000108a9545c in _dispatch_client_callout ()
#30	0x0000000108aa1b74 in _dispatch_block_invoke_direct ()
#31	0x000000018704da04 in __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ ()
#32	0x000000018704d6a8 in -[FBSSerialQueue _performNext] ()
#33	0x000000018704dc44 in -[FBSSerialQueue _performNextFromRunLoopSource] ()
#34	0x0000000184920358 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#35	0x00000001849202d8 in __CFRunLoopDoSource0 ()
#36	0x000000018491fb60 in __CFRunLoopDoSources0 ()
#37	0x000000018491d738 in __CFRunLoopRun ()
#38	0x000000018483e2d8 in CFRunLoopRunSpecific ()
#39	0x00000001866cff84 in GSEventRunModal ()
#40	0x000000018ddeb880 in UIApplicationMain ()
#41	0x00000001051374bc in main at /Users/liuzhen/Documents/CharlyCode/charlyUser/charlyUser/main.m:14

liuzhen2008 avatar Oct 04 '17 22:10 liuzhen2008

Looks like a memory error in nanopb. It'll be difficult to debug this without repro steps or a sample project. Can you share your project or any additional details?

cc @baolocdo

morganchen12 avatar Oct 04 '17 22:10 morganchen12

What is the version of Firebase SDKs? Can you provide the Podfile? Thanks

baolocdo avatar Oct 05 '17 02:10 baolocdo

@liuzhen2008 any update on this?

ryanwilson avatar Oct 11 '17 14:10 ryanwilson

closing, please re-open if this is still an issue.

morganchen12 avatar Oct 11 '17 21:10 morganchen12

For posterity sake,

I did a clean and updated my firebase to 4.3.0

Everything seems to work fine.

Sorry for the distraction guys.

liuzhen2008 avatar Oct 13 '17 15:10 liuzhen2008

@liuzhen2008 no worries, thanks for using Firebase and please file an issue if you run into any problems! :)

ryanwilson avatar Oct 16 '17 13:10 ryanwilson

Hello, I am still getting this issue. Obj-c project, using only Firebase analytics (pod Firebase/Core). App works fine in Debug mode but instantly crashes on [FIRApp configure] if archived (Release) and installed

Saurman avatar Apr 11 '18 06:04 Saurman

@Saurman It may be that you're running into #1052 that others have reported occurs in Xcode 9.3 but not 9.2.

paulb777 avatar Apr 11 '18 13:04 paulb777

Still having this issue and using 4.12.0

I did notice that changing the bundlename to another name resolves the crash. That is also the reasen why new apps work fine when created in 9.3, but apps created before 9.3 crash at FIRApp configure. Both app run exactly the same code.

However. This is not an option because we do not want to release the app as a new app.

We rolled back to xcode 9.2 and this seems to be the only working solution for now.

coolgastjen avatar Apr 11 '18 16:04 coolgastjen

thats not an option for me

Saurman avatar Apr 16 '18 21:04 Saurman

I am also having this issue today. Also it seems as if it's gone when I don't have the debugger attached... Just did a pod update

Installing Firebase 4.13.0 (was 4.12.0)
Installing FirebaseAnalytics 4.2.0 (was 4.1.0)
Installing FirebaseCore 4.0.20 (was 4.0.19)

but am still having the issue.

georgbachmann avatar May 02 '18 07:05 georgbachmann

Managed to get a crash-log be surrounding the call with a try-catch:

*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]
(
    0   CoreFoundation                      0x000000010ac6a1e6 __exceptionPreprocess + 294
    1   libobjc.A.dylib                     0x000000010a05d031 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010acaa0bc _CFThrowFormattedException + 194
    3   CoreFoundation                      0x000000010ab7d951 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 321
    4   CoreFoundation                      0x000000010ab7d7db +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
    5   MyAppName                       0x0000000102a2e223 -[FIRInstanceIDCheckinService checkinParametersWithExistingCheckin:] + 1189
    6   MyAppName                       0x0000000102a2d31e -[FIRInstanceIDCheckinService checkinWithExistingCheckin:completion:] + 168
    7   MyAppName                       0x0000000102a2ad28 -[FIRInstanceIDAuthService fetchCheckinInfoWithHandler:] + 455
    8   MyAppName                       0x0000000102a2a911 -[FIRInstanceIDAuthService performScheduledCheckin] + 186
    9   MyAppName                       0x0000000102a26ba3 -[FIRInstanceID didCompleteConfigure] + 327
    10  MyAppName                       0x0000000102a23b45 -[FIRInstanceID(FIRApp) configureInstanceIDWithOptions:app:] + 265
    11  MyAppName                       0x0000000102a23940 +[FIRInstanceID(FIRApp) didReceiveConfigureSDKNotification:] + 357
    12  CoreFoundation                      0x000000010ac05b8c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
    13  CoreFoundation                      0x000000010ac05a65 _CFXRegistrationPost + 453
    14  CoreFoundation                      0x000000010ac057a1 ___CFXNotificationPost_block_invoke + 225
    15  CoreFoundation                      0x000000010abc7422 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1826
    16  CoreFoundation                      0x000000010abc65a1 _CFXNotificationPost + 609
    17  Foundation                          0x0000000104c5ee57 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
    18  MyAppName                       0x0000000102a0e063 +[FIRApp sendNotificationsToSDKs:] + 393
    19  MyAppName                       0x0000000102a0cf2e +[FIRApp configureDefaultAppWithOptions:sendingNotifications:] + 302
    20  MyAppName                       0x0000000102a0cdf1 +[FIRApp configureWithOptions:] + 90
    21  MyAppName                       0x00000001021053e9 -[AppDelegate application:didFinishLaunchingWithOptions:] + 201
    22  UIKit                               0x00000001064c575b -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 278
    23  UIKit                               0x00000001064c71d2 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4123
    24  UIKit                               0x00000001064cc62b -[UIApplication _runWithMainScene:transitionContext:completion:] + 1677
    25  UIKit                               0x000000010688ee4a __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
    26  UIKit                               0x0000000106c61909 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
    27  UIKit                               0x000000010688ea86 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
    28  UIKit                               0x000000010688f2a7 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675
    29  UIKit                               0x00000001072004d4 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 299
    30  UIKit                               0x000000010720036e -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
    31  UIKit                               0x0000000106ee462d __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
    32  UIKit                               0x00000001070df387 _performActionsWithDelayForTransitionContext + 100
    33  UIKit                               0x0000000106ee44f7 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
    34  UIKit                               0x0000000106c60fb0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
    35  UIKit                               0x00000001064caf0c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
    36  UIKit                               0x0000000106a9da97 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
    37  FrontBoardServices                  0x0000000112c962f3 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331
    38  FrontBoardServices                  0x0000000112c9ecfa __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 225
    39  libdispatch.dylib                   0x000000010cea5848 _dispatch_client_callout + 8
    40  libdispatch.dylib                   0x000000010ceaae14 _dispatch_block_invoke_direct + 592
    41  FrontBoardServices                  0x0000000112cca470 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
    42  FrontBoardServices                  0x0000000112cca12e -[FBSSerialQueue _performNext] + 439
    43  FrontBoardServices                  0x0000000112cca68e -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    44  CoreFoundation                      0x000000010ac0cbb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    45  CoreFoundation                      0x000000010abf14af __CFRunLoopDoSources0 + 271
    46  CoreFoundation                      0x000000010abf0a6f __CFRunLoopRun + 1263
    47  CoreFoundation                      0x000000010abf030b CFRunLoopRunSpecific + 635
    48  GraphicsServices                    0x0000000110711a73 GSEventRunModal + 62
    49  UIKit                               0x00000001064ce0b7 UIApplicationMain + 159
    50  MyAppName                       0x000000010218923f main + 111
    51  libdyld.dylib                       0x000000010cf22955 start + 1
    52  ???                                 0x0000000000000003 0x0 + 3
)```

georgbachmann avatar May 02 '18 13:05 georgbachmann

Thanks for the backtrace @georgbachmann. Seems to be a different problem than was originally reported here, so I'll reopen and recategorize it.

paulb777 avatar May 02 '18 13:05 paulb777

I haven't been able to reproduce the case but for your log specifically, can you check whether your language setting is nothing irregular? Specifically can you print out the following info to see if it's nil? [[NSLocale preferredLanguages] firstObject]

Next release we will add better checking to avoid case like this.

charlotteliang avatar May 02 '18 20:05 charlotteliang

Ok, so for me in my Simulator it's @"de-US",... so not nil... Other fun-fact... It's not crashing any more today without ANY change since yesterday?!?

georgbachmann avatar May 03 '18 07:05 georgbachmann

We've fixed this internally and it'll be out in an upcoming minor release.

If you're still running into this issue, please comment and I'll reopen it.

morganchen12 avatar May 30 '18 22:05 morganchen12