-
Notifications
You must be signed in to change notification settings - Fork 28
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
Ruby LSP Rails failed to initialize server #514
Comments
Thank you for the report! Can you please try the just released v0.3.24? I believe this is the same as Shopify/ruby-lsp#512. |
Hey @vinistock, thank you for the quick reply! Unfortunately, this didn't solve the issue for me: 2024-11-07 13:28:21.469 [info] (platform) Initializing Ruby LSP v0.21.3...
2024-11-07 13:28:21.475 [info] (platform) Auto detected formatter: rubocop
2024-11-07 13:28:21.475 [info] (platform) Auto detected linters: rubocop
2024-11-07 13:28:21.475 [info] (platform) Detected test library: rspec
2024-11-07 13:28:21.475 [info] (platform) Finished initializing Ruby LSP!
2024-11-07 13:28:21.597 [info] (platform) Activating Ruby LSP Rails add-on v0.3.25
2024-11-07 13:28:21.599 [info] (platform) Ruby LSP Rails booting server
2024-11-07 13:28:26.341 [info] (platform) [Error - 1:28:26 PM] Ruby LSP Rails failed to initialize server: /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.25/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:296:in `block in read_response': RubyLsp::Rails::RunnerClient::EmptyMessageError (RubyLsp::Rails::RunnerClient::EmptyMessageError)
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.25/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:293:in `synchronize'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.25/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:293:in `read_response'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11641/lib/types/private/methods/_methods.rb:279:in `bind_call'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11641/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.25/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:91:in `initialize'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11641/lib/types/private/methods/_methods.rb:279:in `bind_call'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11641/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.25/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:16:in `new'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.25/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb:16:in `create_client'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11641/lib/types/private/methods/_methods.rb:279:in `bind_call'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/sorbet-runtime-0.5.11641/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.25/lib/ruby_lsp/ruby_lsp_rails/addon.rb:41:in `block (3 levels) in initialize'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.25/lib/ruby_lsp/ruby_lsp_rails/addon.rb:41:in `synchronize'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.25/lib/ruby_lsp/ruby_lsp_rails/addon.rb:41:in `block (2 levels) in initialize'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.25/lib/ruby_lsp/ruby_lsp_rails/addon.rb:39:in `synchronize'
from /home/alexander/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/ruby-lsp-rails-0.3.25/lib/ruby_lsp/ruby_lsp_rails/addon.rb:39:in `block in initialize'
Server dependent features will not be available |
I get exactly the same error. My ruby version is 3.3.5, but the rest of the versions are the same as Alex (0.3.25) Happy to provide more information if needed to resolve this. |
I have this problem too with v0.3.25. Ruby version 3.2.4. I dug into the code and rdbg into the LSP client. I know the error handling happens as expected. But I don't have log information nor debugger access to the server process. It would be nice to have some more logs or debugger sockets from the server process too. |
#521 may be a contributing factor here. |
I tried your patch. This problem persists. On my end, I have Mongoid 8.1.6. |
Can you share the logs from the Output -> Ruby LSP panel please. |
Of course. Thanks for looking into it.
|
Do you see any errors if running this on the command line:
(get the path using |
This works well:
I did a simple check via pipe (via Content-Length: 70
{"result":{"columns":["column_a","column"],"primary_keys":["column"]}} I will come back to this tomorrow. |
Thanks. My thought was that the Rails app was failing to start (#519), but it seems that's not the case for you. |
Truly. Again, thanks for checking in. I know Shopify has a larger Rails application. Mine is smaller. But it is indeed peculiar. Happy to either dig this deeper or pair on the problem with you somehow. |
If you can try create a vanilla Rails app with ActiveRecord instead of Mongoid, then it may help narrow the cause. |
I bootstraped a 7.2.2 Rails with sqlite3. ruby-lsp-rails commit Logs from VS Code Ruby LSP
Everything looks fine. Then I did
Running Same message:
Both repo has a direnv setup:
This is a bit bizzare. So I suspected my environment. I have both Perhaps a secondary problem is what "bundle" Ruby LSP picks up. When Working on reproduction steps. |
Continued discovery. I can still reproduce the problem without mise. My environment:
Partial `env` output
Reproduction steps:
|
That app doesn't seem to start:
|
I can boot it if comment out the |
Sorry, I still can't reproduce. I don't expect direnv is a factor, but I tried with it just to be sure. (I didn't try with rbenv, as I don't want to risk breaking my current setup, but again I don't think that's a factor). I still think the underlying cause is that your app is failing to boot when running via the add-on. You can perhaps try with some older versions of ruby-lsp-rails to see if there's a release where this started failing. |
Sorry my bad, I didn't include the config. I pushed the new commit 307619e. I suspect it's a Mongoid-related issue. I have included the docker compose with the exact mongoid version in the test app. Can you try my new commit? |
Can you check this for me on your system, in your local terminal:
|
Yep, it's |
Can you try edit your local installation of the gem, and add this debug output in
Then restart VS Code and see what's shown in the Output panel. |
I cleared my environment and tried again. ruby-lsp-rails works. |
Meanwhile I don't have the problem, running on 0.3.26: 2024-11-09 07:17:59.034 [info] (platform) Initializing Ruby LSP v0.21.3...
2024-11-09 07:17:59.041 [info] (platform) Auto detected formatter: rubocop
2024-11-09 07:17:59.041 [info] (platform) Auto detected linters: rubocop
2024-11-09 07:17:59.041 [info] (platform) Detected test library: rspec
2024-11-09 07:17:59.041 [info] (platform) Finished initializing Ruby LSP!
2024-11-09 07:17:59.178 [info] (platform) Activating Ruby LSP Rails add-on v0.3.26
2024-11-09 07:17:59.179 [info] (platform) Ruby LSP Rails booting server
2024-11-09 07:18:04.835 [info] (platform) Finished booting Ruby LSP Rails server
2024-11-09 07:18:04.836 [info] (platform) [dry-types] Dry::Types::Type#safe is deprecated and will be removed in the next major version
2024-11-09 07:18:04.836 [info] (platform) Please use Dry::Types::Type#lax instead.
2024-11-09 07:18:04.836 [info] (platform) /home/alexander/Toptal/platform/config/application.rb:12:in `<main>'
2024-11-09 07:18:04.836 [info] (platform) your 131072x1 screen size is bogus. expect trouble |
Great, we can close the issue. Thanks for helping. |
Closing as the problem is no longer reproducible in 0.3.26. Thank you, @erickguan, for helping! 🙇 🙏 |
Hello,
Since today, I can't start the Ruby LSP server. Here's the output from the logs:
Below is the Ruby LSP debug information. Could you point me to how I can troubleshoot this problem? Thank you. :)
Ruby LSP Information
VS Code Version
1.95.1
Ruby LSP Extension Version
0.8.13
Ruby LSP Server Version
0.21.3
Ruby LSP Addons
Ruby Version
3.2.4
Ruby Version Manager
rbenv
Installed Extensions
Click to expand
Ruby LSP Settings
Click to expand
Workspace
User
The text was updated successfully, but these errors were encountered: