-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
fix(Session): avoid race conditions on clustered setups #46398
Conversation
/backport to stable29 |
/backport to stable28 |
/backport to stable27 |
- re-stablishes old behaviour with cache to return null instead of throwing an InvalidTokenException when the token is cached as non-existing - token invalidation and re-generation are bundled in a DB transaction now Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
346e5c6
to
6a783d9
Compare
$this->atomic(function () use ($sessionId, $uid, $loginName, $pwd, $name, $remember) { | ||
$this->tokenProvider->invalidateToken($sessionId); | ||
$this->tokenProvider->generateToken($sessionId, $uid, $loginName, $pwd, $name, IToken::TEMPORARY_TOKEN, $remember); | ||
}, \OCP\Server::get(IDBConnection::class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ cannot be passed as early dependency in the constructor, it would break setup.
prefer to keep this check as PublicEmitter should be dropped sooner or later Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds reasonable and would safeguard if a second request would try to get the token between the delete and insert of the first request. 👍
We manually applied your proposal to our test platform on version 29.0.3, and it appears to effectively resolve our looping issue after authentication with user_saml as explained in #46165 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
Cypress is unrelated and fixed with #46428 → merge |
Summary
Maybe that is not the final solution to this problem.
Checklist