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

Running bundle install causes Ruby LSP to crash and it won't restart (automatically) #3037

Open
jakeonrails opened this issue Jan 9, 2025 · 0 comments
Labels
bug Something isn't working vscode This pull request should be included in the VS Code extension's release notes

Comments

@jakeonrails
Copy link

Description

Ruby LSP Information

VS Code Version

1.96.2

Ruby LSP Extension Version

0.8.17

Ruby LSP Server Version

0.23.3

Ruby LSP Add-ons

  • Ruby LSP Rails

Ruby Version

3.3.1

Ruby Version Manager

asdf

Installed Extensions

Click to expand
  • EditorConfig (0.16.4)
  • copilot (1.256.1304)
  • copilot-chat (0.23.2)
  • copilot-theme (1.1.0)
  • copy-github-url (0.15.0)
  • gitlens (16.1.1)
  • icons-carbon (0.2.6)
  • rainbow-csv (3.13.0)
  • rainglow (1.5.2)
  • rewrap (1.16.3)
  • ruby-extensions-pack (0.1.12)
  • ruby-lsp (0.8.17)
  • simple-ruby-erb (0.2.1)
  • sorbet-vscode-extension (0.3.37)
  • test-adapter-converter (0.2.1)
  • vscode-eslint (3.0.10)
  • vscode-fileutils (3.10.3)
  • vscode-github-actions (0.27.0)
  • vscode-peacock (4.2.2)
  • vscode-pull-request-github (0.102.0)
  • vscode-rdbg (0.2.2)
  • vscode-ruby-test-adapter-parallel-rspec (0.9.5)
  • vscode-standard-ruby (0.0.16)
  • vscode-tailwindcss (0.12.17)
  • vscode-test-explorer (2.22.1)

Ruby LSP Settings

Click to expand
Workspace
{}
User
{
  "enabledFeatures": {
    "codeActions": true,
    "diagnostics": true,
    "documentHighlights": true,
    "documentLink": true,
    "documentSymbols": true,
    "foldingRanges": true,
    "formatting": true,
    "hover": true,
    "inlayHint": true,
    "onTypeFormatting": true,
    "selectionRanges": true,
    "semanticHighlighting": true,
    "completion": true,
    "codeLens": false,
    "definition": true,
    "workspaceSymbol": true,
    "signatureHelp": true,
    "typeHierarchy": true
  },
  "featuresConfiguration": {},
  "addonSettings": {},
  "rubyVersionManager": {
    "identifier": "auto"
  },
  "customRubyCommand": "",
  "formatter": "auto",
  "linters": null,
  "bundleGemfile": "",
  "testTimeout": 30,
  "branch": "",
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "rubyExecutablePath": "",
  "indexing": {},
  "erbSupport": true,
  "featureFlags": {
    "launcher": false
  }
}

Reproduction steps

Whenever I change my Gemfile (add/remove a gem), I see the error popup:

Warning

Connection to server got closed. Server will not be restarted.

  1. Load a Ruby on Rails project
  2. Ruby LSP starts just fine
  3. Make a change to the Gemfile, add or remove a gem
  4. See the warning (above)
  5. See the log output below:

Code snippet or error message

2025-01-09 14:25:12.145 [info] (my-project-name) Restarting the Ruby LSP because /Users/jakeonrails/source/my-project-name/Gemfile.lock changed, matching {Gemfile.lock,gems.locked}
2025-01-09 14:25:12.653 [info] (my-project-name) /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.23.3/lib/ruby_lsp/base_server.rb:123:in `join': No live threads left. Deadlock? (fatal)
2 threads, 2 sleeps current:0x000000013360a340 main thread:0x000000013360a340
* #<Thread:0x0000000104e6b298 sleep_forever>
   rb_thread_t:0x000000013360a340 native:0x00000001ea80cc00 int:0
   
* #<Thread:0x00000001270145a0 /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.23.3/lib/ruby_lsp/base_server.rb:26 sleep_forever>
   rb_thread_t:0x0000000132876ae0 native:0x000000016b2ef000 int:0 mutex:0x000000013360ac60 cond:1
    depended by: tb_thread_id:0x000000013360a340
   

	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.23.3/lib/ruby_lsp/base_server.rb:123:in `run_shutdown'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.23.3/lib/ruby_lsp/base_server.rb:99:in `block (2 levels) in start'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.23.3/lib/ruby_lsp/global_state.rb:64:in `synchronize'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.23.3/lib/ruby_lsp/global_state.rb:64:in `synchronize'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.23.3/lib/ruby_lsp/base_server.rb:96:in `block in start'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/reader.rb:20:in `read'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.23.3/lib/ruby_lsp/base_server.rb:46:in `start'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.23.3/exe/ruby-lsp:154:in `<top (required)>'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/bin/ruby-lsp:25:in `load'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/bin/ruby-lsp:25:in `<top (required)>'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/cli/exec.rb:58:in `load'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/cli/exec.rb:23:in `run'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/cli.rb:456:in `exec'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/cli.rb:35:in `dispatch'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/cli.rb:29:in `start'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/exe/bundle:28:in `block in <top (required)>'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bundler-2.5.23/exe/bundle:20:in `<top (required)>'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/bin/bundle:25:in `load'
	from /Users/jakeonrails/.asdf/installs/ruby/3.3.1/bin/bundle:25:in `<main>'

2025-01-09 14:25:12.653 [info] (my-project-name) Shutting down Ruby LSP...
2025-01-09 14:25:12.701 [info] (my-project-name) [Error - 2:25:12 PM] Server process exited with code 1.
2025-01-09 14:25:12.701 [info] (my-project-name) [Error - 2:25:12 PM] Connection to server got closed. Server will not be restarted.
2025-01-09 14:25:12.701 [info] (my-project-name) [Error - 2:25:12 PM] Stopping server failed
2025-01-09 14:25:12.701 [info] (my-project-name)   Message: Pending response rejected since connection got disposed
  Code: -32097 
2025-01-09 14:25:12.701 [error] (my-project-name) Error restarting the server: Pending response rejected since connection got disposed

Note:

I am also running Guard with the plugin to run bundler on Gemfile changes. What I noticed is it seems that if guard-bundler updates the Gemfile.lock or if I manually run bundler, it triggers the above failure.

@jakeonrails jakeonrails added bug Something isn't working vscode This pull request should be included in the VS Code extension's release notes labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vscode This pull request should be included in the VS Code extension's release notes
Projects
None yet
Development

No branches or pull requests

1 participant