-
Notifications
You must be signed in to change notification settings - Fork 0
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
A race condition invalidateToken while authenticating a request #412
Comments
Thank you for the detailed report! It seems you have looked to the problem very closely. Maybe it would a good idea to do a pull request with a proposed fix so we can evaluate it, please? Thanks again! |
But invalidateToken is called by nobody:
and If that |
@AlvaroVega Hi, I have a question: you explain that "If that currentToken is set to null in the meantime of authenticate and then fail, some retries (3) will be performed and then no race condition effects will matter". I think the effect in this case is that, it wastes some requests (because the useful currentToken is overwritten by |
It is a race in services/keystoneAuth.js.
I want to call invalidateToken() function to clear currentToken (i.e., set currentToken to null) and then validate other requests using authenticate() function. Then, authenticate() function checks whether currentToken is null, if it is null, it will authenticate the request asynchronously, using request(options, cb). However, another asynchronous authenticating request can return at this time, which sets the currentToken to req.token and impacts the currentToken to non-null (I have called invalidateToken to null to authenticate following request).
The text was updated successfully, but these errors were encountered: