Handle requests received after shutdown message#16262
Merged
dhruvmanila merged 2 commits intomainfrom Feb 20, 2025
Merged
Conversation
Contributor
|
dhruvmanila
commented
Feb 20, 2025
Comment on lines
121
to
125
| lsp::Message::Notification(lsp::Notification { method, .. }) | ||
| if method == lsp_types::notification::Exit::METHOD => | ||
| { | ||
| tracing::error!("Server received an exit notification before a shutdown request was sent. Exiting..."); | ||
| Ok(true) | ||
| anyhow::bail!("Server received an exit notification before a shutdown request was sent. Exiting..."); | ||
| } |
Member
Author
There was a problem hiding this comment.
Using anyhow::bail as a way to exit the server with failure but we could return an explicit ExitStatus instead as well
dhruvmanila
commented
Feb 20, 2025
MichaReiser
reviewed
Feb 20, 2025
MichaReiser
approved these changes
Feb 20, 2025
c079468 to
c7c6444
Compare
dhruvmanila
added a commit
that referenced
this pull request
Feb 28, 2025
## Summary This PR updates the ordering of changelog sections to prioritize `bug` label such that any PRs that has that label is categorized in "Bug fixes" section in when generating the changelog irrespective of any other labels present on the PR. I think this works because I've seen PRs with both `server` and `bug` in the "Server" section instead of the "Bug fixes" section. For example, #16262 in https://github.com/astral-sh/ruff/releases/tag/0.9.7. On that note, this also changes the ordering such that any PR with both `server` and `bug` labels are in the "Bug fixes" section instead of the "Server" section. This is in line with how "Formatter" is done. I think it makes sense to instead prefix the entries with "Formatter:" and "Server:" if they're bug fixes. But, I'm happy to change this such that any PRs with `formatter` and `server` labels are always in their own section irrespective of other labels.
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
This PR should help in astral-sh/ruff-vscode#676.
There are two issues that this is trying to fix all related to the way shutdown should happen as per the protocol:
After the server handled the shutdown request and while waiting for the exit notification:
But, we raised an error and exited. This PR fixes it by entering a loop which responds to any request during this period with
InvalidRequestIf the server received an exit notification but the shutdown request was never received, the server handled that by logging and exiting with success but as per the spec:
So, this PR fixes that as well by raising an error in this case.
Closes: astral-sh/ruff-vscode#676
Test Plan
I'm not sure how to go about testing this without using a mock server.