You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Auth] protect against auth deletion before schedule the ensure token task.
There are two bugs to fix here, both are race conditions while creating / destroying auth in very short time.
The fix includes the following changes:
1. Previous Auth destruction is waiting for all async operation to complete, which would easily cause hang during destruction. In this change actually cancels all on going async operations, which live in two different schedulers.
One scheduler is the auth's own scheduler, that can be cleaned up for no consequence.
The other is persistence scheduler, which is globally shared among all FirebaseApp instances.
2. To clean up async ops in persistence scheduler, we restore the op handler in UserSecureManager, mapped by operation type. We make sure each operation type should only have one valid task. In destruction we can rely on active handlers to cancel all operations.
3. Even with cancelling the operation, the already running tasks will still finish, and thus are going to trigger the callbacks, which would still cause issue during destruction. To avoid this issue we introduced destructing flag for auth instance, and callbacks will abort if already destructing.
PiperOrigin-RevId: 261781967
0 commit comments