Shopify / Shopify/ruby-lsp-rails

Rogue ruby-lsp related processes even after VS Code is quit

Open
#533 18 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Ruby
Stars
688
Forks
44
PR merge metrics
No merged PRs in 30d

Description

Description

From time to time I notice that there are a bunch of ruby processes where I'm pretty sure they are related to ruby-lsp even if the Rails project got already closed or VS Code is no longer running (see details below).

Ruby LSP Information
VS Code Version

1.95.2

Ruby LSP Extension Version

0.8.13

Ruby LSP Server Version

0.21.3

Ruby LSP Addons
  • Ruby LSP Rails
Ruby Version

3.3.5

Ruby Version Manager

chruby

Installed Extensions
Click to expand
  • EditorConfig (0.16.4)
  • code-spell-checker (3.0.1)
  • copilot (1.243.0)
  • copilot-chat (0.22.2)
  • debugpy (2024.12.0)
  • dotenv (1.0.1)
  • even-better-toml (0.19.2)
  • go (0.42.1)
  • haml (1.4.1)
  • makefile-tools (0.11.13)
  • prettier-vscode (11.0.0)
  • python (2024.18.0)
  • remote-containers (0.388.0)
  • remote-explorer (0.4.3)
  • remote-server (1.5.2)
  • remote-ssh (0.115.0)
  • remote-ssh-edit (0.87.0)
  • remote-wsl (0.88.5)
  • rewrap (1.16.3)
  • ruby-extensions-pack (0.1.12)
  • ruby-lsp (0.8.13)
  • rust-analyzer (0.3.2172)
  • shellcheck (0.37.1)
  • solargraph (0.24.1)
  • sorbet-vscode-extension (0.3.37)
  • vscode-docker (1.29.3)
  • vscode-eslint (3.0.10)
  • vscode-fileutils (3.10.3)
  • vscode-github-actions (0.27.0)
  • vscode-graphviz (0.0.9)
  • vscode-kubernetes-tools (1.3.18)
  • vscode-markdownlint (0.56.0)
  • vscode-proto3 (0.5.5)
  • vscode-rdbg (0.2.2)
  • vscode-remote-extensionpack (0.26.0)
  • vscode-standard (2.1.3)
  • vscode-todo-highlight (1.0.5)
  • vscode-typescript-next (5.8.20241106)
  • vscode-yaml (1.15.0)
  • vsliveshare (1.0.5941)
Ruby LSP Settings
Click to expand
Workspace
{
  "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": true,
    "definition": true,
    "workspaceSymbol": true,
    "signatureHelp": true,
    "typeHierarchy": true
  }
}
User
{
  "enableExperimentalFeatures": true,
  "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": true,
    "definition": true,
    "workspaceSymbol": true,
    "signatureHelp": true,
    "typeHierarchy": true
  },
  "featuresConfiguration": {},
  "addonSettings": {},
  "rubyVersionManager": {
    "identifier": "chruby"
  },
  "customRubyCommand": "",
  "formatter": "auto",
  "linters": null,
  "bundleGemfile": "",
  "testTimeout": 30,
  "branch": "",
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "rubyExecutablePath": "",
  "indexing": {},
  "erbSupport": true,
  "useLauncher": false,
  "featureFlags": {}
}
Reproduction steps

Unavailable at this time.

I'm not sure if there is something specific I'm doing that leads to the issue. From time to time I just notice that there are a bunch of ruby processes running where I'm either 100% sure (~/.gem/ruby/3.3.5/gems/ruby-lsp-rails-0.3.23/lib/ruby_lsp/ruby_lsp_rails/server.rb) or pretty sure (~/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch […]) that they are spawned/related to ruby-lsp. I'm only using ruby-lsp from within VSCode.

There must be something off with process cleanup. Especially after quitting VS Code I'd expect all spawned processes to be properly terminated.

This output is from VS Code being terminated (properly quit, closing all windows before, no crashes reported, etc) – ps aux:

tisba            69979   0.0  0.0 410170688   1776   ??  S    Wed06PM   0:01.48 /Users/tisba/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch --format=otnetstring --latency 0.1 /Users/tisba/src/rails_project/lib /Users/tisba/src/rails_project/spec/mailers/previews /Users/tisba/src/rails_project/app/controllers /Users/tisba/src/rails_project/app/decorators /Users/tisba/src/rails_project/app/helpers /Users/tisba/src/rails_project/app/lib /Users/tisba/src/rails_project/app/mailers /Users/tisba/src/rails_project/app/models /Users/tisba/src/rails_project/app/sandbox /Users/tisba/src/rails_project/app/serializers /Users/tisba/src/rails_project/app/validators /Users/tisba/src/rails_project/db
tisba            69978   0.0  0.0 410190144   1472   ??  S    Wed06PM   0:01.37 /Users/tisba/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch --format=otnetstring --latency 0.1 /Users/tisba/src/rails_project/app/views
tisba            69977   0.0  0.0 410163520   1376   ??  S    Wed06PM   0:01.31 /Users/tisba/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch --format=otnetstring --latency 0.1 /Users/tisba/src/rails_project/spec/factories
tisba            69976   0.0  0.0 410171712   1504   ??  S    Wed06PM   0:01.48 /Users/tisba/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch --format=otnetstring --latency 0.1 /Users/tisba/src/rails_project/config/locales
tisba            69975   0.0  0.0 411842656   4144   ??  Ss   Wed06PM   0:00.62 /Users/tisba/.gem/ruby/3.3.5/gems/ruby-lsp-rails-0.3.23/lib/ruby_lsp/ruby_lsp_rails/server.rb
tisba            69974   0.0  0.0 411361424   3520   ??  S    Wed06PM   0:00.39 /Users/tisba/.rubies/ruby-3.3.5/bin/ruby bin/rails runner /Users/tisba/.gem/ruby/3.3.5/gems/ruby-lsp-rails-0.3.23/lib/ruby_lsp/ruby_lsp_rails/server.rb start
tisba            69929   0.0  0.0 412429648   3584   ??  S    Wed06PM   0:07.84 /Users/tisba/.gem/ruby/3.3.5/bin/ruby-lsp
tisba            59817   0.0  0.0 410171712   1776   ??  S    Wed03PM   0:01.82 /Users/tisba/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch --format=otnetstring --latency 0.1 /Users/tisba/src/rails_project/lib /Users/tisba/src/rails_project/spec/mailers/previews /Users/tisba/src/rails_project/app/controllers /Users/tisba/src/rails_project/app/decorators /Users/tisba/src/rails_project/app/helpers /Users/tisba/src/rails_project/app/lib /Users/tisba/src/rails_project/app/mailers /Users/tisba/src/rails_project/app/models /Users/tisba/src/rails_project/app/sandbox /Users/tisba/src/rails_project/app/serializers /Users/tisba/src/rails_project/app/validators /Users/tisba/src/rails_project/db
tisba            59816   0.0  0.0 410173760   1472   ??  S    Wed03PM   0:01.64 /Users/tisba/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch --format=otnetstring --latency 0.1 /Users/tisba/src/rails_project/app/views
tisba            59815   0.0  0.0 410179904   1776   ??  S    Wed03PM   0:01.81 /Users/tisba/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch --format=otnetstring --latency 0.1 /Users/tisba/src/rails_project/lib /Users/tisba/src/rails_project/spec/mailers/previews /Users/tisba/src/rails_project/app/controllers /Users/tisba/src/rails_project/app/decorators /Users/tisba/src/rails_project/app/helpers /Users/tisba/src/rails_project/app/lib /Users/tisba/src/rails_project/app/mailers /Users/tisba/src/rails_project/app/models /Users/tisba/src/rails_project/app/sandbox /Users/tisba/src/rails_project/app/serializers /Users/tisba/src/rails_project/app/validators /Users/tisba/src/rails_project/db
tisba            59814   0.0  0.0 410173760   1472   ??  S    Wed03PM   0:01.66 /Users/tisba/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch --format=otnetstring --latency 0.1 /Users/tisba/src/rails_project/app/views
tisba            59813   0.0  0.0 410182976   1376   ??  S    Wed03PM   0:01.76 /Users/tisba/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch --format=otnetstring --latency 0.1 /Users/tisba/src/rails_project/spec/factories
tisba            59812   0.0  0.0 410163520   1504   ??  S    Wed03PM   0:01.69 /Users/tisba/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch --format=otnetstring --latency 0.1 /Users/tisba/src/rails_project/config/locales
tisba            59811   0.0  0.0 411842496   3888   ??  Ss   Wed03PM   0:00.64 /Users/tisba/.gem/ruby/3.3.5/gems/ruby-lsp-rails-0.3.23/lib/ruby_lsp/ruby_lsp_rails/server.rb
tisba            59810   0.0  0.0 410164544   1376   ??  S    Wed03PM   0:02.07 /Users/tisba/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch --format=otnetstring --latency 0.1 /Users/tisba/src/rails_project/spec/factories
tisba            59809   0.0  0.0 410173760   1504   ??  S    Wed03PM   0:02.13 /Users/tisba/.gem/ruby/3.3.5/gems/rb-fsevent-0.11.2/bin/fsevent_watch --format=otnetstring --latency 0.1 /Users/tisba/src/rails_project/config/locales
tisba            59728   0.0  0.0 411212880   3280   ??  S    Wed03PM   0:00.38 /Users/tisba/.rubies/ruby-3.3.5/bin/ruby bin/rails runner /Users/tisba/.gem/ruby/3.3.5/gems/ruby-lsp-rails-0.3.23/lib/ruby_lsp/ruby_lsp_rails/server.rb start
tisba            59599   0.0  0.0 412176912   3584   ??  S    Wed03PM   0:09.46 /Users/tisba/.gem/ruby/3.3.5/bin/ruby-lsp

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report by starting Ruby LSP with the Ruby LSP Rails add-on, quitting VS Code, and checking the listed ruby-lsp, ruby_lsp_rails/server.rb, and rb-fsevent processes with ps aux. Read the cleanup behavior around ruby_lsp_rails/server.rb and the ruby-lsp process entry point; done means spawned processes reliably terminate after VS Code exits.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.