Repository navigation
[KYUUBI #7776][HA] Stop gracefully without waiting on sessions of a stopped session manager - #7777
Open
afterincomparableyum wants to merge 2 commits into
Conversation
…of a stopped session manager ServiceDiscovery.stopGracefully waits while the active user session count is positive. Once the session manager has stopped, its idle-session timeout checker is shut down, so sessions left by disconnected clients are never closed and the loop never ends. With etcd the loop runs on the non-daemon deregister-watcher-thread, which keeps the engine JVM alive after its SparkContext and backend have stopped. Stop waiting once the session manager is STOPPED, and log a warning with the number of sessions still open.
pan3793
reviewed
Oct 14, 2026
…s in test cleanup
Author
|
@pan3793 could you take another look when you have time please? Thank you! |
This branch has not been deployed
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.
Why are the changes needed?
Close #7776.
ServiceDiscovery.stopGracefullywaits while the active user session count is positive. Once the session manager has stopped, its idle-session timeout checker is shut down, so sessions left by disconnected clients (common withkyuubi.session.close.on.disconnect=false) are never closed and the loop never ends. With etcd the loop runs on the non-daemonderegister-watcher-thread, so the engine JVM cannot exit after its SparkContext and backend have stopped, and the driver pod stays alive until deleted by hand.This change stops waiting once the session manager is
STOPPED, since no session can make progress at that point, and logs a warning with the number of sessions still open. #6790 re-reads the count inside the loop but does not cover this case.How was this patch tested?
Added a case to
DiscoveryClientTeststhat opens a session, stops the session manager, deletes the service node, and expects the service to stop. It runs in both the ZooKeeper and etcd suites.All 12 tests pass. Without the
ServiceDiscoverychange, the new test never finishes and logs1 connection(s) are active, delay shutdownevery 10 seconds.Was this patch assisted by generative AI tooling?
Claude Opus 5.5 was used to assist with debugging and triaging the issue.
Assisted-by: Claude Code with Claude Opus 5.5