Skip to content

[firebase_auth][windows]: SetLogLevel(kLogLevelVerbose) causes 60s cold Firebase.initializeApp stall #18395

Description

@slarimore02

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Auth

Which platforms are affected?

Windows

Description

On Windows, firebase_auth calls this unconditionally in the native plugin constructor:

FirebaseAuthPlugin::FirebaseAuthPlugin() {
  firebase::SetLogLevel(firebase::kLogLevelVerbose);
}

In my app this turns a cold Firebase.initializeApp from sub-second into ~60 seconds.
A/B result:
With the firebase_auth constructor line restored:

    App::Create exit ms=30009
    Auth::GetAuth exit ms=10002
    current_user exit ms=20018 valid=true
    GetPluginConstantsForFirebaseApp exit ms=30026
    Firebase.initializeApp returned after 60667ms

With only this line disabled:
// firebase::SetLogLevel(firebase::kLogLevelVerbose);

and with firebase_auth registration/constants otherwise restored normally:

App::Create exit ms=3
Auth::GetAuth exit ms=2
current_user exit ms=2 valid=true
GetPluginConstantsForFirebaseApp exit ms=5
Firebase.initializeApp returned after 733ms

Suspected cause:
SetLogLevel(kLogLevelVerbose) enables Firebase C++ LogDebug(...) calls. On Windows, the Firebase C++ stdio logger writes through OutputDebugString(...). The slowdown pattern matches roughly one blocking debug-output write per Firebase debug log.

Expected behavior:
firebase_auth should not globally force verbose Firebase C++ SDK logging for every Windows app.

Possible fix:
Remove or gate:

firebase::SetLogLevel(firebase::kLogLevelVerbose);

behind an explicit diagnostic/debug opt-in.

Reproducing the issue

  1. Create or use a Flutter Windows app with:
firebase_core: 4.11.0
firebase_auth: 6.5.4
  1. Ensure the Windows app has a cached signed-in Firebase Auth session.

  2. Add temporary timing logs around the Windows native Firebase.initializeApp path:

    • firebase_core/windows/firebase_core_plugin.cpp: time firebase::App::Create(...)
    • firebase_auth/windows/firebase_auth_plugin.cpp: time Auth::GetAuth(...), auth->current_user(), and GetPluginConstantsForFirebaseApp(...)
  3. Run the app on Windows with the stock firebase_auth Windows plugin code:

FirebaseAuthPlugin::FirebaseAuthPlugin() {
  firebase::SetLogLevel(firebase::kLogLevelVerbose);
}
  1. Observe that cold Firebase.initializeApp blocks for about 60 seconds. In my run:
App::Create exit ms=30009
Auth::GetAuth exit ms=10002
current_user exit ms=20018 valid=true
GetPluginConstantsForFirebaseApp exit ms=30026
Firebase.initializeApp returned after 60667ms
  1. Comment out only this line in firebase_auth/windows/firebase_auth_plugin.cpp:
// firebase::SetLogLevel(firebase::kLogLevelVerbose);
  1. Rebuild and run the same app state again.

  2. Observe that cold Firebase.initializeApp returns in under a second. In my run:

App::Create exit ms=3
Auth::GetAuth exit ms=2
current_user exit ms=2 valid=true
GetPluginConstantsForFirebaseApp exit ms=5
Firebase.initializeApp returned after 733ms

The only behavioral difference between the slow and fast run was whether the firebase_auth Windows plugin constructor called firebase::SetLogLevel(firebase::kLogLevelVerbose);.

Firebase Core version

4.11.0

Flutter Version

3.44.1

Relevant Log Output

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs AttentionThis issue needs maintainer attention.platform: windowsIssues / PRs which are specifically for Windows.plugin: authtype: bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions