[go: nahoru, domu]

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

The Ruby LSP server crashed 5 times in the last 3 minutes #2196

Closed
qupig opened this issue Jun 17, 2024 · 3 comments
Closed

The Ruby LSP server crashed 5 times in the last 3 minutes #2196

qupig opened this issue Jun 17, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@qupig
Copy link
qupig commented Jun 17, 2024

VSCode Ruby LSP
https://marketplace.visualstudio.com/items?itemName=Shopify.ruby-lsp
https://github.com/Shopify/ruby-lsp/blob/main/vscode/README.md
https://github.com/Shopify/ruby-lsp/blob/main/TROUBLESHOOTING.md

{
	"rubyLsp.formatter": "auto",
	"rubyLsp.rubyVersionManager": {
		"identifier": "none",
	},
}

Both the VSCode TERMINAL and the first line of OUTPUT show the correct SHELL, which is /bin/zsh, but I don't know why it keeps trying /bin/sh in the rest.

2024-06-17 09:34:20.143 [info] (project) Running command: `ruby -W0 -rjson -e 'STDERR.print({ env: ENV.to_h, yjit: !!defined?(RubyVM::YJIT), version: RUBY_VERSION }.to_json)'` in project using shell: /bin/zsh
2024-06-17 09:34:21.309 [info] (project) /bin/sh: ruby-lsp: command not found

2024-06-17 09:34:21.310 [info] (project) [Error - 09:34:21] Server process exited with code 127.
2024-06-17 09:34:21.310 [info] (project) [Error - 09:34:21] Server initialization failed.
2024-06-17 09:34:21.310 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-17 09:34:21.310 [info] (project) [Info  - 09:34:21] Connection to server got closed. Server will restart.
2024-06-17 09:34:21.310 [info] (project) true
2024-06-17 09:34:21.310 [info] (project) [Error - 09:34:21] Ruby LSP client: couldn't create connection to server.
2024-06-17 09:34:21.310 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-17 09:34:21.311 [error] (project) Error starting the server: Pending response rejected since connection got disposed
2024-06-17 09:34:21.318 [info] (project) /bin/sh: ruby-lsp: command not found

2024-06-17 09:34:21.319 [info] (project) [Error - 09:34:21] Server process exited with code 127.
2024-06-17 09:34:21.319 [info] (project) [Error - 09:34:21] Server initialization failed.
2024-06-17 09:34:21.319 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-17 09:34:21.319 [info] (project) [Info  - 09:34:21] Connection to server got closed. Server will restart.
2024-06-17 09:34:21.319 [info] (project) true
2024-06-17 09:34:21.319 [info] (project) [Error - 09:34:21] Ruby LSP client: couldn't create connection to server.
2024-06-17 09:34:21.319 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-17 09:34:21.326 [info] (project) /bin/sh: ruby-lsp: command not found

2024-06-17 09:34:21.326 [info] (project) [Error - 09:34:21] Server process exited with code 127.
2024-06-17 09:34:21.326 [info] (project) [Error - 09:34:21] Server initialization failed.
2024-06-17 09:34:21.326 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-17 09:34:21.326 [info] (project) [Info  - 09:34:21] Connection to server got closed. Server will restart.
2024-06-17 09:34:21.326 [info] (project) true
2024-06-17 09:34:21.326 [info] (project) [Error - 09:34:21] Ruby LSP client: couldn't create connection to server.
2024-06-17 09:34:21.326 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-17 09:34:21.326 [info] (project) [Error - 09:34:21] Restarting server failed
2024-06-17 09:34:21.326 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-17 09:34:21.342 [info] (project) /bin/sh: ruby-lsp: command not found

2024-06-17 09:34:21.342 [info] (project) [Error - 09:34:21] Server process exited with code 127.
2024-06-17 09:34:21.343 [info] (project) [Error - 09:34:21] Server initialization failed.
2024-06-17 09:34:21.343 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-17 09:34:21.343 [info] (project) [Info  - 09:34:21] Connection to server got closed. Server will restart.
2024-06-17 09:34:21.343 [info] (project) true
2024-06-17 09:34:21.343 [info] (project) [Error - 09:34:21] Ruby LSP client: couldn't create connection to server.
2024-06-17 09:34:21.343 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-17 09:34:21.343 [info] (project) [Error - 09:34:21] Restarting server failed
2024-06-17 09:34:21.343 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-17 09:34:21.348 [info] (project) /bin/sh: ruby-lsp: command not found

2024-06-17 09:34:21.348 [info] (project) [Error - 09:34:21] Server process exited with code 127.
2024-06-17 09:34:21.349 [info] (project) [Error - 09:34:21] Server initialization failed.
2024-06-17 09:34:21.349 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-17 09:34:21.349 [info] (project) [Error - 09:34:21] The Ruby LSP server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
2024-06-17 09:34:21.349 [info] (project) [Error - 09:34:21] Ruby LSP client: couldn't create connection to server.
2024-06-17 09:34:21.349 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2024-06-17 09:34:21.349 [info] (project) [Error - 09:34:21] Restarting server failed
2024-06-17 09:34:21.349 [info] (project)   Message: Pending response rejected since connection got disposed
  Code: -32097 
@qupig qupig added the bug Something isn't working label Jun 17, 2024
@vinistock
Copy link
Member

Thank you for the bug report. We'll need more details to be able to understand what is going on.

I see that you have the version manager configured to None. How do you install Ruby? And how do you select the right version? We need to be able to activate the Ruby runtime to launch the gem executable.

The /bin/sh is the default when using NodeJS' exec function. But we do use whatever the VS Code API tells us the shell is.

If you check your default VS Code shell in the integrated terminal (click the down arrow), does it match what you expect (zsh)?

image

@qupig
Copy link
Author
qupig commented Jun 20, 2024

How do you install Ruby? And how do you select the right version?

brew install ruby and has been added to PATH in .zchrc.

I don't need to select a version, the global version works fine for me.

check your default VS Code shell in the integrated terminal (click the down arrow)

Interestingly, I don't have a (default) item here, but when I click the + sign it starts a zsh which is the default shell for my account. I assume this is the VSCode initial setup since I've never set it up or modified it.

@vinistock
Copy link
Member

We don't source shell scripts automatically, so if you're adding things manually to the PATH in a configuration file, that's the reason why we don't find it.

Sourcing shell scripts has caused a lot of headaches to users in the past and we moved completely away from it.

In this case, you will need to configure custom activation to let the Ruby LSP know how to find the Ruby version:

// Your VS Code settings
{
  // Set the manager to custom
  "rubyLsp.rubyVersionManager": {
    "identifier": "custom",
  },

  // Define a shell script that runs immediately before trying to launch, doing
  // whatever needs to be done to find Ruby. In your case, add the right path
  // to the PATH
  "rubyLsp.customRubyCommand": "PATH=/path/to/ruby/bin:$PATH",
}

@vinistock vinistock closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants