[2.x] feat: drop other idle servers on client exit (#8610)#8701
Merged
eed3si9n merged 2 commits intosbt:developfrom Feb 6, 2026
Merged
[2.x] feat: drop other idle servers on client exit (#8610)#8701eed3si9n merged 2 commits intosbt:developfrom
eed3si9n merged 2 commits intosbt:developfrom
Conversation
Contributor
Author
|
@eed3si9n Could you please review this pr? |
eed3si9n
reviewed
Feb 6, 2026
main/src/main/scala/sbt/internal/server/LanguageServerProtocol.scala
Outdated
Show resolved
Hide resolved
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.
Summary
Implements cooperative idle server cleanup for
sbtn(issue #8610). When a client disconnects from an sbt server, that server notifies allother registered servers to shut down if they've been idle long enough and have no connected clients. This prevents accumulation of idle
background JVMs across projects.
fixes #8610
Problem
Each
sbtnsession leaves a background JVM server running with a 7-day idle timeout. Users working across many projects accumulate idleservers that waste system resources (memory, file descriptors, threads).
Solution
<PID>.jsonfile in a shared proc directory (~/.cache/sbt/v2/proc/on Linux,~/Library/Caches/sbt/v2/proc/on macOS).sbt/dropIfIdleJSON-RPC notification to all other registered servers.dropIfIdleshuts down if idle >=sbt.server.secondaryIdleTimeout(default 600s) AND has no initializedNetworkChannelclients.initializehandshake) triggernotifyOtherServersondisconnect. Temporary
dropIfIdleconnections never initialize, so their removal won't cascade.Testing
-Dsbt.server.secondaryIdleTimeout=5, verified proc file created, sentdropIfIdlenotification, confirmedserver drops when idle with no clients and stays alive when a client is connected.