Repository navigation
fix: send the exit notification before the connection of a stopped language server closes - #2013
Merged
lagergren merged 1 commit intoNov 17, 2026
Conversation
…nguage server closes Signed-off-by: Daniel Biehl <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the shutdown change that waits for queued messages before stopping the connection provider.
No open issues 🎉
What changed in this PR
Addresses #2012 by waiting for queued messages, including exit, to finish writing before stopping a language server’s connection provider.
Changes:
- Adds a message-writer wait capped at one second, while preserving the no-wait behavior for disposed servers.
- Adds a socket regression test that delays writing
exitand checks that the server receives it without lifecycle errors.
| File | Description |
|---|---|
src/test/java/com/redhat/devtools/lsp4ij/server/SocketLanguageServerTest.java |
Adds delayed-write coverage for delivery of exit during shutdown. |
src/main/java/com/redhat/devtools/lsp4ij/LanguageServerWrapper.java |
Waits for queued writes before stopping the connection provider. |
Review effort: Balanced
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2013 +/- ##
==========================================
- Coverage 49.17% 49.13% -0.05%
==========================================
Files 812 812
Lines 33017 33027 +10
Branches 6750 6751 +1
==========================================
- Hits 16237 16228 -9
- Misses 14235 14254 +19
Partials 2545 2545 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
|
Agreed This is a bug and should go in 0.30.0 |
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.
Fixes #2012.
After the
exitnotification,shutdownAllnow waits until the message writer has sent the messages queued so far, for a second at most, and only then stops the connection provider. A disposed language server sends no messages, so its stop doesn't wait, as before.SocketLanguageServerTest.testAStopSendsTheExitNotificationBeforeItClosesTheConnectionstops a language server that runs in the test and checks that it receivesexit. Its connection provider takes 100 ms to writeexit, as a writer that has other messages to send first does, so that without the change the stop losesexitevery time. The test fails without the change and passes with it. Locally, on Linux,./gradlew testpasses (1,724 tests, 7 skipped). In PyCharm 2026.1, two restarts of a language server started withstartAndAcceptleft noSocket closedin the LSP console, and the old processes exited by themselves.