metals-vscode icon indicating copy to clipboard operation
metals-vscode copied to clipboard

Client Metals: connection to server is erroring. Shutting down server.

Open huntario opened this issue 9 months ago • 16 comments

Describe the bug

Things were going awesome as I was step debugging through some tests using the inline test debugging option. Then it started to get slower and slower, until it locked up. Then I restarted the computer, uninstalled/reinstalled the Metals extension, and VSCode as well.

I will say I'm on Scala 2.13.5 but everything was working great fir my needs until this debug session seemed to trip me up and lock me out. Upgrading isn't an immediate option for me so mainly just posting in case others run into it.

I'm also seeing the same behavior as https://github.com/scalameta/metals-vscode/issues/1488 when this occurs. The buttons are unreactive.

Have "metals.javaHome": "/Users/hunter.leachman/.sdkman/candidates/java/current/bin/java" set in settings.json

Using coursier located at /usr/local/bin/coursier
/Users/hunter.leachman/.sdkman/candidates/java/current/bin/java -version:
openjdk version "17.0.11" 2024-04-16
/Users/hunter.leachman/.sdkman/candidates/java/current/bin/java -version:
OpenJDK Runtime Environment Temurin-17.0.11+9 (build 17.0.11+9)
OpenJDK 64-Bit Server VM Temurin-17.0.11+9 (build 17.0.11+9, mixed mode)
Using Java Home: /Users/hunter.leachman/.sdkman/candidates/java/current
Error: Could not find or load main class scala.meta.metals.Main
Caused by: java.lang.ClassNotFoundException: scala.meta.metals.Main
[Error - 4:11:10 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 4:11:10 AM] Connection to server got closed. Server will restart.
true
[Error - 4:11:10 AM] Metals client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
Error: Could not find or load main class scala.meta.metals.Main
Caused by: java.lang.ClassNotFoundException: scala.meta.metals.Main
[Error - 4:11:10 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 4:11:10 AM] Connection to server got closed. Server will restart.
true
[Error - 4:11:10 AM] Metals client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
Could not launch Metals Language Server:
Pending response rejected since connection got disposed
Release notes was not shown: not showing release notes since they've already been seen for your current version
Error: Could not find or load main class scala.meta.metals.Main
Caused by: java.lang.ClassNotFoundException: scala.meta.metals.Main
[Error - 4:11:10 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 4:11:10 AM] Connection to server got closed. Server will restart.
true
[Error - 4:11:10 AM] Metals client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 4:11:10 AM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
Error: Could not find or load main class scala.meta.metals.Main
Caused by: java.lang.ClassNotFoundException: scala.meta.metals.Main
[Error - 4:11:10 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 4:11:10 AM] Connection to server got closed. Server will restart.
true
[Error - 4:11:10 AM] Metals client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 4:11:10 AM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
Error: Could not find or load main class scala.meta.metals.Main
Caused by: java.lang.ClassNotFoundException: scala.meta.metals.Main
[Error - 4:11:10 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 4:11:10 AM] The Metals server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 4:11:10 AM] Metals client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 4:11:10 AM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097

I've tried the Pre-release version. I noticed Bloop had a new release a few hours before my issues began? - https://scalacenter.github.io/bloop/setup#sbt -

I'm also getting these messages -

Client Metals: connection to server is erroring. Shutting down server. write EPIPE Metals client: couldn't create connection to server. Restarting server failed The Metals server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Everything was going so well, it's like these errors are cached somewhere and won't go away?

The project compiles with sbt

Nothing seems to make the errors go away/

To Reproduce Steps to reproduce the behavior:

  1. Use the inline test debugging for a few semi-long sessions, setting a few break points in a few files
  2. Repeat and maybe notice the debugger taking longer and longer to connect?
  3. Eventually it locks up, and the errors above continue after restarting, reinstalling, switching to pre/release versions

Expected behavior The errors at least go away after restarting computer, the plugin, or uinstalling/reinstalling

Screenshots

Screenshot 2024-04-30 at 4 41 17 AM

Screenshot 2024-04-30 at 5 02 59 AM

Installation:

  • Operating system: macOS/Windows/Linux Screenshot 2024-04-30 at 5 04 12 AM

  • VSCode version: Screenshot 2024-04-30 at 5 04 46 AM

  • VSCode extension version:

  • Metals version: (found in VSCode settings, under metals.serverVersion) Screenshot 2024-04-30 at 5 06 22 AM Screenshot 2024-04-30 at 5 06 10 AM

Additional context Everything was working so perfectly until these errors started seemingly out of no where.

Really appreciate y'all and the work you are doing. This has come a long way in the last 2 years since the last time I tried out Metals. I'm thiiiiiiiiis close (finger to thumb) to replacing IntelliJ, almost there.

"Metals client: couldn't create connection to server." "he Metals server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information." "Restarting server failed"

huntario avatar Apr 30 '24 10:04 huntario