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

Metals hangs out "Starting Metals server..." a long time #6762

Open
happyieee opened this issue Sep 5, 2024 · 7 comments
Open

Metals hangs out "Starting Metals server..." a long time #6762

happyieee opened this issue Sep 5, 2024 · 7 comments
Labels
bug Something that is making a piece of functionality unusable

Comments

@happyieee
Copy link

Describe the bug

I built Scala with metals on vscode. I used it well the other day. Yesterday, I don't know if it suddenly stopped working because I uninstalled some useless software. The plug-in appears to have stopped at some stage without any error message other than "Starting" Metals servers "hangs here. My computer is correctly configured with JDK17. JAVA_HOME is also correctly added to the environment variable. I tried reloading the vscode and metals plugins, but it didn't work.

image

To Reproduce

Steps to reproduce the behavior:

1.Open a Scala project
2. Metals hongs out "Starting Metals server..." a long time

Screenshots

Metals output:
image

Extension Host output:
image

Installation:

  • Operating system: Windows 11
  • JAVA version : JDK 17
  • VSCode version: v1.92.2
  • Metals version: v1.39.0
@tgodzik
Copy link
Contributor

tgodzik commented Sep 5, 2024

I wonder if this is an issue with JDK being located on a different drive 🤔 Though we should get some kind of error still. Is the java process actually started? Did anything got written to .metals/metals.log? Do you have any custom settings set or any sbtopts/jvmopts file?

@happyieee
Copy link
Author

Thank you for your reply.

  1. I tried to install different Java environments,·JDK11, JDK21. But the same as JDK17.

  2. The Java process i saw in windows explorer is actually running.
    image

  3. The workspace was not found. The Metals folder, and its log.
    image

  4. When stuck in Starting Metals server... happened . I modified the sbt configuration file sbt\conf\sbtconfig.txt and .sbt\repositories. Because my network is not good, I added a mirror image for it. But it still doesn't work.

  5. I tried to skip Metals and build projects directly using sbt, and sbt did get stuck. I don't know if my Metals stuck is related to sbt, do Metals not output any information?

@tgodzik
Copy link
Contributor

tgodzik commented Sep 6, 2024

I tried to skip Metals and build projects directly using sbt, and sbt did get stuck. I don't know if my Metals stuck is related to sbt, do Metals not output any information?

It should output it both to the output tab in vs code and to .metals/metals.log file. I wonder if maybe it's stuck trying to actually download metals itself.

Are you able to coursier to fetch metals, if you don't have it locally I see that it has been downloaded for you in .metals directory in your home directory.

You could do cs.exe fetch org.scalameta:metals_2.13:1.3.5

@happyieee
Copy link
Author

I do 'cs fetch org.scalameta:metals_2.13:1.3.5' and the output is
image
But it still doesn't work.

@tgodzik
Copy link
Contributor

tgodzik commented Sep 9, 2024

The good news is that it doesn't seem to be hanging on downloading. Could you try to get some information about the Java process being run maybe?

To get the pid:
jps -l | grep scala.meta.metals.Main
To get full info about JDKs
jps -lv
and you can also get stacktraces of the process:
jstack <PID>

@happyieee
Copy link
Author

Here's the info:
image

@tgodzik
Copy link
Contributor

tgodzik commented Sep 9, 2024

Och, this looks like maybe the issue is here dirs-dev/directories-jvm#55

We might need to work around that 🤔

@tgodzik tgodzik transferred this issue from scalameta/metals-vscode Sep 9, 2024
@tgodzik tgodzik changed the title Metals hongs out "Starting Metals server..." a long time Metals hangs out "Starting Metals server..." a long time Sep 9, 2024
@tgodzik tgodzik added the bug Something that is making a piece of functionality unusable label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable
Projects
None yet
Development

No branches or pull requests

2 participants