Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay LS shutdown when last client disconnects #7254

Merged
merged 3 commits into from
Jul 18, 2023

Conversation

hubertp
Copy link
Contributor

@hubertp hubertp commented Jul 11, 2023

Pull Request Description

Rather than closing Language Server immediately, we delay the shutdown until some timeout hits. This gives a chance for new clients to connect without paying the price of the initialization again.

More importantly, during hibernation/restart, the connection between client (IDE) and LS is severed so it appears as if client disconnect. In fact a few moments later IDE would attempt to re-establish the connection on the same port. Without this change, LS shutsdown and further attempts to connect on that particular port will fail.

There are still problems on the IDE-side after waking up from hibernation but it is not related to Language Server.

Important Notes

Partially solves #5197.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

Rather than closing Language Server immediately, we delay the shutdown
until some timeout hits. This gives a chance for new clients to connect
without paying the price of the initialization again.

More importantly, during hibernation/restart, the connection between
client (IDE) and LS is severed so it appears as if client disconnect. In
fact a few moments later IDE would attempt to re-establish the
connection on the same port. Without this change, LS shutsdown and
further attempts to connect on that particular port will fail.

There are still problems on the IDE-side after waking up from
hibernation but it is not related to Language Server.
@hubertp hubertp force-pushed the wip/hubert/5197-delay-shutdown branch from af35d58 to 1f73e0e Compare July 11, 2023 09:40
@hubertp hubertp added the CI: No changelog needed Do not require a changelog entry for this PR. label Jul 11, 2023
Can't/shouldn't use the same timeout value as for shutdown timeout for
delaying shutdowns initiated by lack of clients.
@hubertp
Copy link
Contributor Author

hubertp commented Jul 13, 2023

Ping @4e6 @JaroslavTulach

@xvcgreg xvcgreg merged commit 9252eb5 into develop Jul 18, 2023
27 checks passed
@xvcgreg xvcgreg deleted the wip/hubert/5197-delay-shutdown branch July 18, 2023 06:37
mergify bot pushed a commit that referenced this pull request Jul 28, 2023
close #7345

#7254 introduced a delayed shutdown timeout. The `LanguageServerGateway` timeout should include the delayed shutdown time to prevent false timeouts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants