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

“Start Metals server” keeps loading forever #1226

Open
Yorklandian opened this issue Nov 15, 2022 · 15 comments
Open

“Start Metals server” keeps loading forever #1226

Yorklandian opened this issue Nov 15, 2022 · 15 comments

Comments

@Yorklandian
Copy link

Describe
I just installed scala and sbt from the official website and also have Metals installed in VSCode. I opened an empty folder, tring to create a new scala project using Metals. However, by clicking whether "New Scala project" or "Start metals", it only kept running the notification status bar and nothing appeared in the left bars. The output of metals only showed the info about jdk and metals‘ version. Please see the screenshots below. So what should I do about it? My jdk, JAVA_HOME are all fine with my java projects and I can run scala and sbt in Windows cmd.

Plus, metals seems to be ok when I use it in my linux server via vscode ssh. Is there something wrong with metals' Windows version?

Environment
OS: Windows 10
VS Code: 1.73.1
Metals extension: 1.20.0
Metals: 0.11.9
Java:11.0.17
Scala: 2.13.10
sbt:1.8.0
$env:JAVA_HOME C:\Program Files\Java\jdk11.0.17

Screenshots
image

image

image

@tgodzik
Copy link
Contributor

tgodzik commented Nov 15, 2022

Thanks for reporting! It looks like it fails in the prerelease version, does it work when you use the last stable one?

@tgodzik
Copy link
Contributor

tgodzik commented Nov 15, 2022

Also, there might be some additional logs in other outputs (Extension Host, Window etc.). Though it is very rare that the window would show nothing. One possible workaround could be that you change the java home setting to an invalid one and allow metals to download it itself. That would mean metals is not working with the Java it uses currently (though it should work without issues).

Another problem could be an older VS Code version 🤔 but from what I've seen it gets automatically updated on Windows.

@Yorklandian
Copy link
Author

Still, it doesn't work in the stable version (I was in the stable version 1.20.0 before) and it strangely find my JAVA_HOME even though I've removed it from my system variables...
And logs from ExtensionHost seem useless
But still, everything works fine in my linux server connected via SSH...
image
image
image

@tgodzik
Copy link
Contributor

tgodzik commented Nov 15, 2022

it strangely find my JAVA_HOME even though I've removed it from my system variables...

We use a library that will try to find java on the system, so the best way around it is to make Java home invalid and force metals to try and download it.

Also, could you change the Metals server version to 0.11.9 in the settings to be sure?

@Yorklandian
Copy link
Author

Neither worked. Changing version to 0.11.9 still stuck at "Starting Metals server". Using a wrong JAVA_HOME did get me to download a new one, but the download always exit with code 1 and leave nothing changed. (As shown in the pics)
image
image
image

@tgodzik
Copy link
Contributor

tgodzik commented Nov 16, 2022

looks like it's not able to download the Java or Metals. Is it possible you have some kind of proxy?

@Yorklandian
Copy link
Author

Yeah,I‘m in China. The connections to github and many other websites are usually blocked , so I have a proxy set via Clash to ensure the connections. But after shutting the proxy, I'm still stuck. And my linux server connected via the same wifi works just fine with metals

@tgodzik
Copy link
Contributor

tgodzik commented Nov 16, 2022

Maybe running via proxy with some additional JVM settings specified?

https://scalameta.org/metals/docs/troubleshooting/proxy#proxy-settings

The biggest issue here is that it seems to be hanging instead of throwing an exception that we can take a look at. We might need to add some more debug statements to see what is going on.

I am out of ideas currently, but if you have time you could try setting up the Metals extension and try adding log statements locally for you. It is not super complicated (install yarn locally, run yarn install and an F5 in VS Code. ). You can add console.log() statements or breakpoints starting from activate in extension.ts file.

Of course, that is if you feel like looking into it. I am trying to think of something in the meantime

@hzhu212
Copy link

hzhu212 commented Apr 17, 2023

@tgodzik I got a very similar issue on MacOS.

Environment
OS: 13.2.1 (22D68)
VS Code: 1.77.3
Metals extension: v1.22.0
Metals: 0.11.11
Java: 17.0.6
Scala: 2.12.17
sbt: 1.8.2

There are few messages in the Metals output panel:

image

When I killed the Java process with TaskManager, it appears more message:

image

it looks like Metals got stucked at downloading packages, but I can download the jars with browsers very quickly.

After checking the doc link about proxy given by the notification, I found the issue comes from Coursier. When I run the coursier command, it produces the same message:

$ ~/.vscode/extensions/scalameta.metals-1.22.0/coursier                                                                                                                                           
Waiting for ongoing concurrent download for https://repo1.maven.org/maven2/com/squareup/okio/okio/1.17.2/okio-1.17.2.jar
Waiting for ongoing concurrent download for https://repo1.maven.org/maven2/com/google/collections/google-collections/1.0/google-collections-1.0.jar

How can I continue with the issue of Coursier?

@tgodzik
Copy link
Contributor

tgodzik commented Apr 17, 2023

I wonder if it's an issue with corusier version. You could install coursier locally, add to PATH and switch to prereelase version of Metals. It should use your locally installed coursier version afterwards.

@hzhu212
Copy link

hzhu212 commented Apr 18, 2023

@tgodzik yes, it worked! Thank you.
I installed Coursier with Homebrew and ran cs setup, then updated Metals plugin to preview version. now everything works smoothly.

@tgodzik
Copy link
Contributor

tgodzik commented Apr 18, 2023

Thanks for confirming! We need to figure out a better way of getting coursier automatically for users.

@bonaluo
Copy link

bonaluo commented Mar 28, 2024

I've fixed some problems already, but now I am stuck, "Metals server" keeps starting.

image

@tgodzik
Copy link
Contributor

tgodzik commented Mar 28, 2024

It did manage to get Java, so everything should work. You can fallback to normal release version if you are using a prerelease, but first maybe you could check Extension host logs instead of the Metals ones?

@Pablo-hub44
Copy link

not works 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants