firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.67k stars 1.49k forks source link

Early Crash at [FPRSelectorInstrumentor initWithSelector: class: isClassSelector:] for the iOS App #9836

Closed theAwake closed 1 day ago

theAwake commented 2 years ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

This is an early crash while launching the App. I have gone through other bug reports where it was mentioned to update the SDK version to the latest. But we are still facing the issues.

Firebase Crashlytics shows this as an "early crash". We don't have a way to reproduce it. It occurs sometime.

Relevant Code:

I am adding the crash stack trace:

Thread 13 Queue : com.google.FPRNSURLSessionInstrumentation (serial)
#0  0x00000001162865f2 in -[NSProcessInfo environment] ()
#1  0x00000001143d9d45 in __FPRAssert at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Common/FPRDiagnostics.m:22
#2  0x00000001143f4cff in -[FPRSelectorInstrumentor initWithSelector:class:isClassSelector:] at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Instrumentation/FPRSelectorInstrumentor.m:58
#3  0x00000001143d155c in -[FPRClassInstrumentor buildAndAddSelectorInstrumentorForSelector:isClassSelector:] at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Instrumentation/FPRClassInstrumentor.m:82
#4  0x00000001143d10fb in -[FPRClassInstrumentor instrumentorForInstanceSelector:] at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Instrumentation/FPRClassInstrumentor.m:53
#5  0x00000001143e2600 in SelectorInstrumentor at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Instrumentation/Network/FPRNetworkInstrumentHelpers.m:56
#6  0x00000001143ec1fb in InstrumentUploadTaskWithStreamedRequest at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Instrumentation/Network/FPRNSURLSessionInstrument.m:465
#7  0x00000001143eaeb7 in __58-[FPRNSURLSessionInstrument registerInstrumentorForClass:]_block_invoke at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Instrumentation/Network/FPRNSURLSessionInstrument.m:678
#8  0x00000001191aca2c in _dispatch_client_callout ()
#9  0x00000001191bc076 in _dispatch_lane_barrier_sync_invoke_and_complete ()
#10 0x00000001143eac3e in -[FPRNSURLSessionInstrument registerInstrumentorForClass:] at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Instrumentation/Network/FPRNSURLSessionInstrument.m:652
#11 0x00000001143ed08f in __InstrumentSessionWithConfigurationDelegateDelegateQueue_block_invoke at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Instrumentation/Network/FPRNSURLSessionInstrument.m:174
#12 0x00000001143ecdf1 in __InstrumentSessionWithConfiguration_block_invoke at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Instrumentation/Network/FPRNSURLSessionInstrument.m:125
#13 0x0000000113d33f92 in -[RCNConfigFetch newFetchSession] at /Users/LocalUser/Documents/Company/myapp/Pods/FirebaseRemoteConfig/FirebaseRemoteConfig/Sources/RCNConfigFetch.m:547
#14 0x0000000113d30656 in -[RCNConfigFetch initWithContent:DBManager:settings:analytics:experiment:queue:namespace:options:] at /Users/LocalUser/Documents/Company/myapp/Pods/FirebaseRemoteConfig/FirebaseRemoteConfig/Sources/RCNConfigFetch.m:102
#15 0x0000000113d1f197 in -[FIRRemoteConfig initWithAppName:FIROptions:namespace:DBManager:configContent:analytics:] at /Users/LocalUser/Documents/Company/myapp/Pods/FirebaseRemoteConfig/FirebaseRemoteConfig/Sources/FIRRemoteConfig.m:156
#16 0x0000000113d243d4 in -[FIRRemoteConfigComponent remoteConfigForNamespace:] at /Users/LocalUser/Documents/Company/myapp/Pods/FirebaseRemoteConfig/FirebaseRemoteConfig/Sources/FIRRemoteConfigComponent.m:63
#17 0x0000000113d1ec70 in +[FIRRemoteConfig remoteConfigWithFIRNamespace:app:] at /Users/LocalUser/Documents/Company/myapp/Pods/FirebaseRemoteConfig/FirebaseRemoteConfig/Sources/FIRRemoteConfig.m:98
#18 0x00000001143f03d6 in __38+[FPRRemoteConfigFlags sharedInstance]_block_invoke at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Configurations/FPRRemoteConfigFlags.m:62
#19 0x00000001191aca2c in _dispatch_client_callout ()
#20 0x00000001191adf10 in _dispatch_once_callout ()
#21 0x00000001143f0351 in _dispatch_once [inlined] at /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/usr/include/dispatch/once.h:84
#22 0x00000001143f0336 in +[FPRRemoteConfigFlags sharedInstance] at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Configurations/FPRRemoteConfigFlags.m:61
#23 0x00000001143d5468 in -[FPRConfigurations setupRemoteConfigFlags] at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Configurations/FPRConfigurations.m:132
#24 0x00000001143d535a in __27-[FPRConfigurations update]_block_invoke at /Users/LocalUser/Documents/Company/myapp/Pods/FirebasePerformance/FirebasePerformance/Sources/Configurations/FPRConfigurations.m:117
#25 0x00000001191ab848 in _dispatch_call_block_and_release ()
#26 0x00000001191aca2c in _dispatch_client_callout ()
#27 0x00000001191b33a6 in _dispatch_lane_serial_drain ()
#28 0x00000001191b40bc in _dispatch_lane_invoke ()
#29 0x00000001191c0472 in _dispatch_workloop_worker_thread ()
#30 0x000000011b253074 in _pthread_wqthread ()
#31 0x000000011b251ffb in start_wqthread ()

Sometimes we are able to see this crash in debug build while running through the Xcode. I have console output as well. Happy to share it over mail for more details.

Please let us know the fix for this issue.

rizafran commented 2 years ago

Hi @theAwake, for any private information, you may try to share them including your console output logs to dps-firebase-files@google.com.

visumickey commented 2 years ago

@theAwake Thanks for sharing the stack trace. It is great that this is happening in the development environment. We would be able to gather more information. Looking at this issue, there are few information that would be very helpful for us to debug further.

  1. Are you able to reproduce this issue consistently? If so, can you share a sample project for us to take a look at?
  2. Can you share the rest of the threads during the crash? That would help us to understand if there were any race conditions that is triggering this issue.
  3. In the stack trace you have shared, the crash points to this line of code. This typically happens when the platform changes the name of the class that we are instrumenting (for measuring network request performance) in times when the class does KVO operation underneath (eg: implementing methods like observeValueForKeyPath). Can you let us know if the class underneath your network requests does any KVO operation?
  4. Since this is happening in the dev environment, can you enable the debug logs and share the console logs when this crash occurs.

With the current information, it would be tricky for us to debug this further. While we can figure out other possible options where this crash could occur, the details above can expedite our exploration.

theAwake commented 2 years ago

@visumickey

  1. This issue occurs occasionally. Not able to reproduce it every time.
  2. I have mailed information to the dps-firebase-files@google.com mail id.
  3. Don't know much about KVO operation.
  4. I will enable debug logs for the Firebase with -FIRDebugEnabled. Will share the debug logs once it happens again in debug build.

Crashlytics also shows early crashes for the following:

[FPRSelectorInstrumentor swizzle] -[GAIDataStore coordinatorWithModel:URL:] +[GAICoreDataUtil entityWithDescription:]

Please let me know what else you need.

theAwake commented 2 years ago

visumickey

Again I was able to reproduce a similar crash but this time at [FPRSelectorInstrumentor swizzle]. I have shared the console logs and all thread stack trace through mail id.

theAwake commented 2 years ago

@visumickey

Hi, any update on this issue? Have you checked the logs and stack trace I have shared?

exaby73 commented 1 day ago

Since this issue hasn't had any updates recently and I am not able to reproduce it, I am closing this issue. If this issue occurs again, please file a new issue with information about your current environment. Thank you