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

AuthBackendRPCImplementation Crashes (Firebase v11.2) #13650

Closed
ondrejkorol opened this issue Sep 16, 2024 · 7 comments · Fixed by #13658
Closed

AuthBackendRPCImplementation Crashes (Firebase v11.2) #13650

ondrejkorol opened this issue Sep 16, 2024 · 7 comments · Fixed by #13658
Assignees

Comments

@ondrejkorol
Copy link

Description

Hi Firebase team,

I’ve encountered crash in my app after updating to Firebase 11.2.0 and GoogleSignIn 8.0.0. The crash is reported by Crashlytics and has occurred on user devices running iOS 17.6.1. I’m using Xcode 15.4 for development and publishing the app. I can't reproduce it locally.

We discussed this crash in this GitHub thread but I was advised to open a new issue here.

There are two "different crashes" so far:
Crash Details:
• Exception Type: EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000003
• Thread: com.apple.root.user-initiated-qos.cooperative
• Affected File: AuthBackend.swift - Line 143
• Function: specialized AuthBackendRPCImplementation.callInternal(with:) + 143

The first crash stack trace:
app_issue_466ae93783cfc5e3010951fc92f6e334_crash_session_c89332271f904df98a543d8daf437162_DNE_0_v2_stacktrace.txt
second.crash_issue_466ae93783cfc5e3010951fc92f6e334_crash_session_449ef354ab5e4450b4e53a2fde399be3_DNE_0_v2_stacktrace.txt

A different stack trace:
crash.type2.txt

I'd appreciate any guidance on how to mitigate this crash. Please let me know if you need any additional information to help diagnose this issue.

Thank you for your assistance.

Best regards,

Ondrej

Reproducing the issue

No response

Firebase SDK Version

11.2

Xcode Version

15.4

Installation Method

Swift Package Manager

Firebase Product(s)

Authentication, Crashlytics, Firestore, Messaging

Targeted Platforms

iOS

Relevant Log Output

No response

If using Swift Package Manager, the project's Package.resolved

No response

If using CocoaPods, the project's Podfile.lock

No response

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@ncooke3
Copy link
Member

ncooke3 commented Sep 16, 2024

Hi @ondrejkorol, thanks for opening the issue! I just merged #13647 will should hopefully address the problem. I wasn't able to reproduce it, but my rationale from looking at the stack trace is that the shared concurrency queue (com.apple.root.user-initiated-qos.cooperative) is being blocked by a call to [FIRHeartbeatLogger headerValue] which makes a synchronous dispatch to a different queue. Swift concurrency's shared co-op queue should not be blocked (Swift forums), so the SDK has been changed to execute that synchronous call onto another thread of the queue.

I suspect the second kind of crash is related since it does have the same Crashed: stack, but it is interesting so I will investigate it a bit more.

Crashed: com.apple.root.user-initiated-qos.cooperative
0  libswiftCore.dylib             0x4043a4 swift_unknownObjectRetain + 48
...

@ondrejkorol
Copy link
Author

That sounds great! I really appreciate your fast response and the whole team’s support. So I guess I should wait for a new Firebase version, and then we can try that.

Yeah, it's tricky as it's not easily reproducible, right? Let me know if I can help somehow.
Cheers!

@ncooke3
Copy link
Member

ncooke3 commented Sep 17, 2024

So I guess I should wait for a new Firebase version, and then we can try that.

Yes, @ondrejkorol. Though in the meantime, I do have some tips that may help reproduce it:

  • All of the three traces are doing something with Metal on the main thread, and Firebase Auth is either trying to sign in or refresh a token. It could be a coincidence but it seems suspicious. Hopefully this is a clue to the part of your app causing the crash (e.g. maybe Metal is used for an intricate animation while the user authenticates). If Metal isn't being used at the time where a user logs in, than it it likely due to Auth happening to refresh the auth token in the background while Metal is also doing work. If this sounds like more of a possibility, than you could try to recreate the situation by calling the func getIDToken(forcingRefresh forceRefresh: Bool = false) async throws -> String with forceRefresh = true around the time that Metal is also doing work.
  • EXC_BAD_ACCESS KERN_INVALID_ADDRESS indicates a memory issue, so testing in release mode should give a higher chance of exposing the bad state than debug mode would (https://stackoverflow.com/a/44571456/9331576).
Screenshot 2024-09-17 at 9 06 14 AM - Enable ASan profiler Screenshot 2024-09-17 at 9 54 21 AM

@ncooke3
Copy link
Member

ncooke3 commented Sep 17, 2024

Between #13647 and #13658, this issue should be addressed in the next Firebase 11.3 release.

@fanwgwg
Copy link

fanwgwg commented Sep 18, 2024

@ncooke3 +1 Thank you for your information. This is now starting to impact our users in production and causing crashes. When will be a new release containing these fixes?

@ajunjunandtmac
Copy link

@ncooke3 +1 Thank you for your information. This is now starting to impact our users in production and causing crashes. When will be a new release containing these fixes?

same issue, and cause a lot of crashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants