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
Multiple workspace folders result in too many ruby-lsp processes using vscode-ruby-lsp #1865
Comments
Thank you for reporting this issue! It does indeed seem like some sort of race condition. A few questions to help understand what's going on:
Not 100% sure yet, but I'm suspecting there might be a race condition in our lazy activation here. |
No
Neither, it can happen without any files being open. But it seems like you are kinda right. I have no issues if I open these projects in a separate window. It only start to happens once I have two or more added folders. Maybe I'm lucky but it seems to happen on subsequent folders only, never for the first once. |
I have no experience with typescript, but that loop in chruby looks suspicious to me ruby-lsp/vscode/src/ruby/chruby.ts Line 84 in 044568e
Because I get a lot of these messages in my output ruby-lsp/vscode/src/ruby/chruby.ts Line 106 in 044568e
Chruby has the sad behavior that it doesn't even set a default ruby version if I'm outside of a .ruby-version file. So I'm having multiple .ruby-version files across my file system. Could that help to elevate the issue?
// Edit: removing .ruby-version files does not change the situation. |
I'm able to reproduce the problem on MacOS using Ruby 3.3.0, 3 new rails apps (rails new + bundle add ruby-lsp) and chruby. |
Unfortunately, I haven't been able to reproduce this, so I'm unsure about where the bug is exactly. Since we're awaiting the If you can reliably reproduce it and would like to debug, here is a suggestion of how to approach it:
this.outputChannel.info("something")
If we can pin point exactly which promise is allowing for the race condition, then we can fix this. |
Description
Note: I am aware that ruby-lsp spawns a process for each open workspace folder in vscode. That is expected. In my case it is spawning a lot of processes for a specific project folder, which is unexpected.
Reproduction steps
Using
ruby-lsp: bundle gemfile
settingUsing "healthy" folders in the workspace
I can add multiple projects to a vscode window and ruby-lsp starts normally
Adding "unhealthy" folders to the workspace
After I add certain rails apps vscode-ruby-lsp suddenly starts spawning a lot of processes for that single added rails project. That behavior multiplies for each of these projects.
That of course kills my server due to high CPU and memory usage.
Setup
Other
I am unable to pin down why it happens in these folders. I don't even know where to start but it feels like a bug or race condition within vscode-ruby-lsp. I already tried a variety of settings but I just could not solve my problem.
The text was updated successfully, but these errors were encountered: