Destroy stale sessions without a lock#81310
Merged
Conversation
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Don't hold
NamedSessionsStorage::mutexwhile destroying stale sessions. Fixes #71307Logs: https://pastila.nl/?000c4a4b/384edaa6b888a3d8fcfbf275b1e1fac2#YGtn/olp6K1dM4cz+3D8/w==
Thread 123121 got stuck somewhere for 6 seconds while getting a session for
tx_async 19 "alter table test update value = 18 where id = 2". In the meantime,tx_async 19 "commit"was waiting for the previous query in tx_wait, buttimeout 5 tail --pid=$query_pid -f /dev/nulltimed out in 5 seconds. Then we also look for the previous query in system.processes, but it wasn't there yet because thread 123121 was still stuck on getting session and didn't start processing the query. Sotx_async 19 "commit"started executing and got "Session is locked by a concurrent client"Looks like thread 123121 was waiting on the mutex in acquireSession. The lock was held by thread 10168 while cleaning old sessions and rolling back unfinished transactions: https://pastila.nl/?00f522cd/99e913c3fd765a0354d6279d59d086bc#iKrL5stckRaL46ceM1WEGg==
Let's destroy session objects without holding the lock
Documentation entry for user-facing changes