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

Auto-restart on server crashing, up to 5 times #2145

Merged
merged 16 commits into from
Dec 21, 2022
Merged

Conversation

LDAP
Copy link
Contributor

@LDAP LDAP commented Dec 20, 2022

This PR aims to do two things:

  • BREAKING: Provide the exit code to the LSP-* helper plugins. That allows for special actions on certain exit codes. (E.g. jdtls is known to crash with code -13 if the workspace cache is corrupted.)
  • Auto restart servers a few times before asking the user what to do

Open questions:

  • Where should the state about crashed servers be stored? (WindowManager, ClientConfig, ...)
  • How often do we attempt to restart the server? When is the counter reset?
    (e.g. Increase the counter if the last crash was <30s apart, else reset the counter. If the counter reaches 5, ask the user and reset the counter?)

@rchl
Copy link
Member

rchl commented Dec 20, 2022

  • Where should the state about crashed servers be stored? (WindowManager, ClientConfig, ...)

We remember state when the plugin crashes in WindowsConfigManager so that's the right place to use.

How often do we attempt to restart the server? When is the counter reset?

I believe VSCode triggers it on 5th crash in the last 3 minutes.

@LDAP LDAP marked this pull request as ready for review December 20, 2022 19:36
@LDAP
Copy link
Contributor Author

LDAP commented Dec 20, 2022

I could not find any plugin that uses the on_session_end_async API, which was changed in this PR.

@rchl
Copy link
Member

rchl commented Dec 20, 2022

I could not find any plugin that uses the on_session_end_async API, which was changed in this PR.

Yes, me neither.

plugin/core/configurations.py Outdated Show resolved Hide resolved
plugin/core/configurations.py Outdated Show resolved Hide resolved
plugin/core/configurations.py Outdated Show resolved Hide resolved
plugin/core/sessions.py Outdated Show resolved Hide resolved
LDAP and others added 3 commits December 20, 2022 22:28
Co-authored-by: Rafał Chłodnicki <rchl2k@gmail.com>
Co-authored-by: Rafał Chłodnicki <rchl2k@gmail.com>
Co-authored-by: Rafał Chłodnicki <rchl2k@gmail.com>
@LDAP LDAP requested a review from rchl December 21, 2022 08:44
plugin/core/windows.py Outdated Show resolved Hide resolved
LDAP and others added 2 commits December 21, 2022 11:35
Co-authored-by: Rafał Chłodnicki <rchl2k@gmail.com>
@LDAP LDAP requested a review from rchl December 21, 2022 10:46
plugin/core/windows.py Outdated Show resolved Hide resolved
@LDAP LDAP requested a review from rchl December 21, 2022 11:49
@rchl rchl changed the title [Feature] Recover from server crash Auto-restart on server crashing, up to 5 times Dec 21, 2022
@rchl rchl merged commit 2ce155a into sublimelsp:main Dec 21, 2022
rchl added a commit that referenced this pull request Jan 16, 2023
* main: (30 commits)
  Make Document Symbols behavior more consistent with built-in Goto Symbol (#2166)
  docs: fsautocomplete config - remove redundant argument (#2165)
  Allow missing window/workDoneProgress/create request from the server (#2159)
  Use "plaintext" language ID for plain text files (#2164)
  Improve type annotations (#2162)
  Don't use "escapeall" extension when formatting with mdpopups (#2163)
  Cut 1.21.0
  Fix inlay hint parts wrapping into multiple lines (#2153)
  Ensure commands triggered from minihtml run on correct view (#2154)
  Add "Source Action" entry to the "Edit" main menu (#2149)
  Add "Refactor" entry to the "Edit" main menu (#2141)
  fix completion documentation being parsed as markdown twice (#2146)
  when going to definition scroll to start of the region, not end (#2147)
  Auto-restart on server crashing, up to 5 times (#2145)
  improve performance of completion & signature request on typing (#2148)
  fix code lenses not updating after Undo (#2139)
  docs: fix mixed indentation in language servers configuration
  add missing Goto commands to Command Palette (#2140)
  docs: add missing keyboard shortcuts (#2143)
  Pass force_group to LocationPicker (#2134)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants