scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.08k stars 328 forks source link

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

Open happyieee opened 3 weeks ago

happyieee commented 3 weeks ago

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

  1. Metals hongs out "Starting Metals server..." a long time

Screenshots

Metals output: image

Extension Host output: image

Installation:

tgodzik commented 3 weeks ago

I wonder if this is an issue with JDK being located on a different drive :thinking: 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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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

tgodzik commented 3 weeks ago

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 commented 3 weeks ago

Here's the info: image

tgodzik commented 3 weeks ago

Och, this looks like maybe the issue is here https://github.com/dirs-dev/directories-jvm/issues/55

We might need to work around that :thinking:

kirillsemyonkin commented 6 days ago

+1 for the same issue on roughly the same pc specs. tried deleting every .bloop and .metals i could find, and updating whenever there are updates, and nothing helps for roughly the same time period as this issue is open. unable to work on my scala project, luckily i have other non-scala projects to do, but imagine this happening to someone who doesnt have this kind of luxury. would be great if i could temp fix it by downgrading, but downgrading the extension doesnt help and i dont know where to downgrade everything else...