Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash at [FIRInstanceIDTokenManager checkTokenRefreshPolicyWithIID:] function #4167

Closed
phaninderkumar opened this issue Oct 25, 2019 · 6 comments

Comments

@phaninderkumar
Copy link

Environment:

  • Xcode version: 11.0
  • Firebase SDK version: 6.11.0
  • Firebase Component: Core, Messaging
  • Component version: 6.3.2, ~> 4.1.7

Problem:
My project keeps crashing at [FIRInstanceIDTokenManager checkTokenRefreshPolicyWithIID:] function.
My app collects location in suspended state if it exits a region. My assumption is this crashes happens at that time. Not always though.

Steps to reproduce:

Configure the firebase project and make sure the app is launched from suspended state multiple times

Attaching my crash log here
crashReport.txt

@phaninderkumar
Copy link
Author

Here is the list of Firebase pods being used:

  • Firebase/Core (6.11.0):
    • Firebase/CoreOnly
    • FirebaseAnalytics (= 6.1.3)
  • Firebase/CoreOnly (6.11.0):
    • FirebaseCore (= 6.3.2)
  • Firebase/Messaging (6.11.0):
    • Firebase/CoreOnly
    • FirebaseMessaging (~> 4.1.7)
  • FirebaseAnalytics (6.1.3):
    • FirebaseCore (~> 6.3)
    • FirebaseInstanceID (~> 4.2)
    • GoogleAppMeasurement (= 6.1.3)
    • GoogleUtilities/AppDelegateSwizzler (~> 6.0)
    • GoogleUtilities/MethodSwizzler (~> 6.0)
    • GoogleUtilities/Network (~> 6.0)
    • "GoogleUtilities/NSData+zlib (~> 6.0)"
    • nanopb (~> 0.3.901)
  • FirebaseAnalyticsInterop (1.4.0)
  • FirebaseCore (6.3.2):
    • FirebaseCoreDiagnostics (~> 1.0)
    • FirebaseCoreDiagnosticsInterop (~> 1.0)
    • GoogleUtilities/Environment (~> 6.2)
    • GoogleUtilities/Logger (~> 6.2)
  • FirebaseCoreDiagnostics (1.1.1):
    • FirebaseCoreDiagnosticsInterop (~> 1.0)
    • GoogleDataTransportCCTSupport (~> 1.0)
    • GoogleUtilities/Environment (~> 6.2)
    • GoogleUtilities/Logger (~> 6.2)
    • nanopb (~> 0.3.901)
  • FirebaseCoreDiagnosticsInterop (1.0.0)
  • FirebaseInstanceID (4.2.6):
    • FirebaseCore (~> 6.0)
    • GoogleUtilities/Environment (~> 6.0)
    • GoogleUtilities/UserDefaults (~> 6.0)
  • FirebaseMessaging (4.1.7):
    • FirebaseAnalyticsInterop (~> 1.3)
    • FirebaseCore (~> 6.2)
    • FirebaseInstanceID (~> 4.1)
    • GoogleUtilities/AppDelegateSwizzler (~> 6.2)
    • GoogleUtilities/Environment (~> 6.2)
    • GoogleUtilities/Reachability (~> 6.2)
    • GoogleUtilities/UserDefaults (~> 6.2)
    • Protobuf (>= 3.9.2, ~> 3.9)
  • GoogleAppMeasurement (6.1.3):
    • GoogleUtilities/AppDelegateSwizzler (~> 6.0)
    • GoogleUtilities/MethodSwizzler (~> 6.0)
    • GoogleUtilities/Network (~> 6.0)
    • "GoogleUtilities/NSData+zlib (~> 6.0)"
    • nanopb (~> 0.3.901)
  • GoogleDataTransport (3.0.1)
  • GoogleDataTransportCCTSupport (1.2.1):
    • GoogleDataTransport (~> 3.0)
    • nanopb (~> 0.3.901)
  • GoogleUtilities/AppDelegateSwizzler (6.3.1):
    • GoogleUtilities/Environment
    • GoogleUtilities/Logger
    • GoogleUtilities/Network
  • GoogleUtilities/Environment (6.3.1)
  • GoogleUtilities/Logger (6.3.1):
    • GoogleUtilities/Environment
  • GoogleUtilities/MethodSwizzler (6.3.1):
    • GoogleUtilities/Logger
  • GoogleUtilities/Network (6.3.1):
    • GoogleUtilities/Logger
    • "GoogleUtilities/NSData+zlib"
    • GoogleUtilities/Reachability
  • "GoogleUtilities/NSData+zlib (6.3.1)"
  • GoogleUtilities/Reachability (6.3.1):
    • GoogleUtilities/Logger
  • GoogleUtilities/UserDefaults (6.3.1):
    • GoogleUtilities/Logger
  • KeychainSwift (11.0.0)
  • MBProgressHUD (1.1.0)
  • nanopb (0.3.904):
    • nanopb/decode (= 0.3.904)
    • nanopb/encode (= 0.3.904)
  • nanopb/decode (0.3.904)
  • nanopb/encode (0.3.904)
  • Protobuf (3.10.0)

@maksymmalyhin
Copy link
Contributor

@chliangGoogle Could you help with the issue investigation please. Here is what I investigated so far.

Looks like the crash happens because cachedIID is nil here. The particular crash itself is fixed in #4096.
As far as I can see from the code cachedIID should be nil only in case of the Keychain access failure. The Keychain access failure in the background may be a caused by using deprecated kSecAttrAccessibleAlwaysThisDeviceOnly value for kSecAttrAccessible on iOS 13 here. I assume it should be replaced by kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly.

@charlotteliang
Copy link
Contributor

@maksymmalyhin You are right, it is strange that IID becomes nil when a token exists. I haven't been able to reproduce on my side. I agree #4096 should fix this but we can also adjust the keychain option here.

@charlotteliang
Copy link
Contributor

@phaninderkumar can you also send us the debugLog right before the crash if you can reproduce? This can help us figure out why the instanceID is not retrieved successfully

@phaninderkumar
Copy link
Author

phaninderkumar commented Oct 30, 2019

@chliangGoogle, I'm not able to reproduce this crash while the app is running. It happens when the app is launched from suspended state when the devices is locked and hence the only logs I have are from the Fabric crash logs.

@charlotteliang
Copy link
Contributor

@phaninderkumar Thanks, this confirms that it is caused by the security framework on keychain access level, we've updated it at #4172. But your crash should be resolved in #4096 which will release soon.

@firebase firebase locked and limited conversation to collaborators Nov 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants