Hello,
I've noticed that a few race conditions may occur:
-
When renewing expired credentials, gAuth is updated before generating a new value for jwt. If two tasks happens concurrently and the first one gets preempted after updating gAuth but before the new jwt has been written, the second task may assume the expired jwt is still valid and reuse it, causing an authorization error.
- Likelihood: May happen occasionally. A robust application should be able to recover from errors and retry later.
-
When changing the configuration, existing credentials are not invalidated.
- Likelihood: Won't happen when using FCM as described in the documentation.
-
When resetting the configuration to nil, a fatal error may occur in an ongoing task (including warmupCache()) that needs configuration to be present.
- Likelihood: Won't happen when using FCM as described in the documentation.
-
When using FCM immediately after it was configured, getAccessToken() may attempt to read gAuth before it has been set by warmupCache(), causing a fatal error.
- Likelihood: Very unlikely to happen for an HTTP application. Likely to happen for a CLI application or unit tests that use FCM.
-
When the application is shut down, its storage gets cleared, which may cause a fatal error to occur in an ongoing task (including warmupCache()) that needs configuration or gAuth to be present.
- Likelihood: Very unlikely to happen for an HTTP application. Likely to happen for unit tests that configure FCM (even without using it).
Hello,
I've noticed that a few race conditions may occur:
When renewing expired credentials,
gAuthis updated before generating a new value forjwt. If two tasks happens concurrently and the first one gets preempted after updatinggAuthbut before the newjwthas been written, the second task may assume the expiredjwtis still valid and reuse it, causing an authorization error.When changing the
configuration, existing credentials are not invalidated.When resetting the
configurationtonil, a fatal error may occur in an ongoing task (includingwarmupCache()) that needsconfigurationto be present.When using FCM immediately after it was configured,
getAccessToken()may attempt to readgAuthbefore it has been set bywarmupCache(), causing a fatal error.When the application is shut down, its storage gets cleared, which may cause a fatal error to occur in an ongoing task (including
warmupCache()) that needsconfigurationorgAuthto be present.