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

Hang Risk warning on configure call

Open tristan-warner-smith opened this issue 1 year ago • 7 comments

Description

We have a SwiftUI app and we're occasionally seeing these Hang Risk warnings.

We initialise Firebase in our app Initialiser.

struct OurApp: App {
    init() {
        FirebaseApp.configure()
    }
}

The warning is: Thread running at User-interactive quality-of-service class waiting on a lower QoS thread running at Default quality-of-service class. Investigate ways to avoid priority inversions

Here's the stack trace. image

Reproducing the issue

Create a SwiftUI app as above, configuring Firebase. Run the app in Xcode with the debugger attached. Sporadically, witness behaviour as described.

Firebase SDK Version

10.25

Xcode Version

15.4

Installation Method

Swift Package Manager

Firebase Product(s)

AB Testing, Analytics, Authentication, Crashlytics, DynamicLinks, Firestore, Functions, In-App Messaging, Performance, Remote Config, Storage

Targeted Platforms

iOS

Relevant Log Output

No response

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

Expand Package.resolved snippet

Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

Replace this line with the contents of your Podfile.lock!

tristan-warner-smith avatar Jun 06 '24 08:06 tristan-warner-smith

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

google-oss-bot avatar Jun 06 '24 08:06 google-oss-bot

FirebaseDynamicLinks is deprecated and support will end in 2025.

We may not be able to address this and recommend that you transition the app away from Dynamic Links.

https://firebase.google.com/support/dynamic-links-faq

paulb777 avatar Jun 06 '24 17:06 paulb777

FirebaseDynamicLinks is deprecated and support will end in 2025.

We may not be able to address this and recommend that you transition the app away from Dynamic Links.

https://firebase.google.com/support/dynamic-links-faq

Hey Paul,

We use Dynamic Links purely for Firebase Authentication. The docs say "we will provide an update that will require a client- side update to ensure that email link auth continues working after the Firebase Dynamic Links service is shut down" but as far as I can see, this change has not been made yet.

tristan-warner-smith avatar Jun 11 '24 14:06 tristan-warner-smith

@tristan-warner-smith It's true that the Firebase Auth Dynamic Links replacement is not yet available. However, Firebase Authentication only requires the Firebase Dynamics Links back end to be set up on the console. It does not need the SDK to be built into the app.

paulb777 avatar Jun 11 '24 14:06 paulb777

Firebase Auth isn't our only auth provider and we need to know for a given deeplink, whether it's been handled by Firebase Auth. We currently have the following for that, but if there's an alternative, that would be great.

func handle(url: URL, completion: ((URL?) -> Void)?) -> Bool {
        DynamicLinks.dynamicLinks().handleUniversalLink(url) { dynamicLink, _ in
            completion?(dynamicLink?.url)
        }
    }

tristan-warner-smith avatar Jun 11 '24 14:06 tristan-warner-smith

Do you need the link processing that handleUniversalLink does? Versus directly calling the completion block?

 func handle(url: URL, completion: ((URL?) -> Void)?) -> Bool {
            completion?(url)
    }

paulb777 avatar Jun 11 '24 14:06 paulb777

We do, this code could definitely use a refactor but this is internally wrapped in:

func parseFirebase(url: URL) async -> Deeplink? {
        await withCheckedContinuation { continuation in
            _ = dynamicLinks.handle(url: url, completion: { _ in
                if let parsedDeeplink = Self.parseInternalNavigationDeeplink(from: url.relativePath) {
                    continuation.resume(returning: parsedDeeplink)
                } else {
                    continuation.resume(returning: nil)
                }
            })
        }
    }

tristan-warner-smith avatar Jun 11 '24 15:06 tristan-warner-smith

Closing, since the Dynamic Links SDK will be deleted this year

paulb777 avatar Jan 21 '25 22:01 paulb777