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 does not start anymore on Windows in VS Code since the VS Code extension v1.30.0 #1488

Closed
sjrd opened this issue Apr 19, 2024 · 47 comments
Labels
bug Something isn't working

Comments

@sjrd
Copy link

sjrd commented Apr 19, 2024

Describe the bug

I (automatically) updated Metals in VS Code to the latest release from April 15 on a Windows machine. Now Metals just ... does not start anymore. No "Starting Metals". The Metals tab shows the "New Scala project" and "Start Metals" blue buttons, but clicking on them does not do anything. No logs that I can find either. No .metals directory. It's almost as if it is not even there. I don't even get syntactic help like auto-indent on Enter after an =.

Things I tried:

  • Removing my .bsp/.vscode/.metals from before
  • Uninstalling and reinstalling Metals from scratch
  • Checked the Metals Java version; it says 17

On my Linux machine at work I haven't observed any issue.

Expected behavior

Er ... at least show me an error message I guess? Ideally successfully start.

Operating system

Windows

Editor/Extension

VS Code

Version of Metals

v1.3.0

Extra context or search terms

No response

@sjrd
Copy link
Author

sjrd commented Apr 19, 2024

Downgrading to the VS Code extension v1.29.0 solved the issue, even though it uses Metals 1.3.0 anyway. So this seems to be related to v1.30.0 of the VS Code extension, in fact.

@sjrd sjrd changed the title Metals does not start anymore on Windows in VS Code since v1.3.0 Metals does not start anymore on Windows in VS Code since the VS Code extension v1.30.0 Apr 19, 2024
@tgodzik
Copy link
Contributor

tgodzik commented Apr 21, 2024

It looks like we have a timeout inside one of the dependencies which causes the Metals never to find proper Java home. I removed that library in the prerelease, could you try it out?

@tgodzik tgodzik transferred this issue from scalameta/metals Apr 22, 2024
@tgodzik tgodzik added the bug Something isn't working label Apr 22, 2024
@tgodzik
Copy link
Contributor

tgodzik commented Apr 23, 2024

@sjrd could you try the latest prerelease?

@sjrd
Copy link
Author

sjrd commented Apr 23, 2024

I haven't had much time on a Windows machine since my report. I can try tomorrow evening.

@smarkess
Copy link

I have the same issue on Mac. Switching to pre-release didn't work. Only downgrading to 1.29 works

@tgodzik
Copy link
Contributor

tgodzik commented Apr 25, 2024

@sebastianmarkowski what shows up in your logs? It should not hang the same way since we removed the library that was hanging.

@tgodzik
Copy link
Contributor

tgodzik commented Apr 25, 2024

I also just merged another fix that will fall back to java on PATH. So that should be even safer, do let us know what shows up for you if that still doesn't work.

If it works I will release 1.31.0 later on.

@smarkess
Copy link

@tgodzik
Still not working. In output tab I get

Metals version: 1.2.2
Fetching coursier
Coursier: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Coursier: 0     0    0     0    0
Coursier: 0      0      0 --:--:-- --:--:-- --:--:--     0
Coursier: 0     0    0     0    0     0      0
Coursier: 0 --:--:-- --:--:-- --:--:--     0
Coursier: 67 19.2M   67 13.0M    0     0  12.1M      0
Coursier: 0:00:01  0:00:01 --:--:-- 12.1M
Coursier: 100 19.2M  100 19.2M    0     0  15.4M      0  0:0
Coursier: 0:01  0:00:01 --:--:-- 35.9M
Coursier: gzip: (stdin): trailing garbage ignored
Failed to fetch coursier. You may want to try installing coursier manually and adding it to PATH.
Error: Process exited with code 2
Release notes was not shown: not showing release notes since they've already been seen for your current version

@tgodzik
Copy link
Contributor

tgodzik commented Apr 25, 2024

Looks like it's another issue and the coursier fails to properly download 🤔 What is you operating system?

@tgodzik
Copy link
Contributor

tgodzik commented Apr 25, 2024

Ach ok nvm, I see it's mac

@tgodzik
Copy link
Contributor

tgodzik commented Apr 25, 2024

This might have been a problem with a download, we could add a retry, does it happen every time for you?

@smarkess
Copy link

Every single time.
I checked pre-release versions one by one and it started happening with 1.29.2

@tgodzik
Copy link
Contributor

tgodzik commented Apr 25, 2024

Maybe you would be able to run this manually and get more error messages:
curl -fL https://github.com/coursier/coursier/releases/download/v2.1.9/cs-x86_64-apple-darwin.gz | gzip -d > cs or alternatively use https://github.com/VirtusLab/coursier-m1/releases/download/v2.1.9/cs-aarch64-apple-darwin.gz for M1

@smarkess
Copy link

smarkess commented Apr 25, 2024

% curl -fL https://github.com/coursier/coursier/releases/download/v2.1.9/cs-x86_64-apple-darwin.gz | gzip -d > cs
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 19.2M  100 19.2M    0     0  15.4M      0  0:00:01  0:00:01 --:--:-- 29.3M
gzip: (stdin): trailing garbage ignored

So it's the same message minus the "failed to fetch"
It seems like the issue isn't downloading but processing unpacked file.

My Mac is 12.4 which I can't update due to company policy

@tgodzik
Copy link
Contributor

tgodzik commented Apr 25, 2024

Maybe it's an issue with gzip version? Looks like the only way yo work around it is to fallback to use coursier.jar as previously, but that will only work if JAVA_HOME is set.

@yadavan88
Copy link

yadavan88 commented May 3, 2024

I also have the same problem with VS Code on my Mac(14.4.1).
I downgraded to 1.29.0 and it worked for me.

@tgodzik
A request for a temporary situation:
Is it possible to re-release with the working version as 1.31.0 so that newbies don't run into this problem? I doubt how many people will find this issue and downgrade to an earlier version for the fix.
(I am having a meetup with live coding for Java people next week. They will be installing metals for first time. Everyone will need to explicitly downgrade the version. So, just thinking from that perspective)

Thanks

@tgodzik
Copy link
Contributor

tgodzik commented May 3, 2024

I wanted to fix one more thing, but you're right, we should do a new release with the current fixes. Will do it Sunday or Monday, sorry about that!

@tgodzik
Copy link
Contributor

tgodzik commented May 5, 2024

I release a new version, do let me know if it works.

@yadavan88
Copy link

Thank you so much @tgodzik
It works with the new update! :)

@tgodzik tgodzik closed this as completed May 6, 2024
@tgodzik
Copy link
Contributor

tgodzik commented May 6, 2024

Glad to hear it!

@smarkess
Copy link

smarkess commented May 7, 2024

It still doesn't work for me, so I guess there's an issue with older mac version. It would be cool if there was some way to specify max version for an extension depending on operating system.

@tgodzik
Copy link
Contributor

tgodzik commented May 7, 2024

What is an error you are getting? I need to still do another workaround

@smarkess
Copy link

smarkess commented May 7, 2024

The exact same. Nothing changed for me.

@yadavan88
Copy link

@smarkess did you already try uninstall the plugin and reinstall? Initially it didn't work for me as well. Then I uninstalled plugin and deleted metadata files. Then it worked for me . Thought it might be some coincidence and ignored it

@smarkess
Copy link

smarkess commented May 7, 2024

@yadavan88
Clean uninstall (with manually removing metadata files after uninstalling extension by UI) also didn't work

@hhucchenyixiao
Copy link

I am still encountering this issue using version 1.31.0.

@tgodzik
Copy link
Contributor

tgodzik commented May 8, 2024

@hhucchenyixiao the problem the same as in the description of the issue?

@hhucchenyixiao
Copy link

@hhucchenyixiao the problem the same as in the description of the issue?
Yes, it's exactly as described in the issue, it shows "No Scala project found", and clicking either of the buttons does not elicit any response.
图片

@tgodzik
Copy link
Contributor

tgodzik commented May 8, 2024

Could you check Output (metals) if there is any info?

@yadavan88
Copy link

@tgodzik @smarkess
I am not sure, but now it is not working.
I was pretty sure that it worked when I posted the message, but now when I try to use again, getting the same problem.
My apologies

@yadavan88
Copy link

@tgodzik
Just one more update.
Now I know why it worked. I have 2 mac books, it works fine in one, but not in the other.

Working mac: Macbook air - 12.7 (attaching the screenshot)
Not working: Macbook Pro - 14.4

image

@sjrd
Copy link
Author

sjrd commented May 10, 2024

Sorry for the radio silence. v1.31.0 works fine over here on Windows. Thank you :)

@tgodzik
Copy link
Contributor

tgodzik commented May 14, 2024

The fallback to the old way of fetching metals has been added back. Can anyone having issues let us know if that fixed something? You need to switch to newest prerelease.

@yadavan88
Copy link

@tgodzik
Still the same for me, in mac 14.4.1

image

@tgodzik
Copy link
Contributor

tgodzik commented May 14, 2024

@yadavan88 could you check Metals output to see what is being logged? View -> Output and choose Metals in the dropdown.

@yadavan88
Copy link

Hi @tgodzik

Metals version: 1.3.0
Using coursier located at /Users/yadukrishnankrishnan/Library/Application Support/Coursier/bin/coursier
/Users/yadukrishnankrishnan/Library/Caches/Coursier/arc/https/github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9.1%252B1/OpenJDK11U-jdk_x64_mac_hotspot_11.0.9.1_1.tar.gz/jdk-11.0.9.1+1/Contents/Home/bin/java -version:
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9.1+1)
/Users/yadukrishnankrishnan/Library/Caches/Coursier/arc/https/github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9.1%252B1/OpenJDK11U-jdk_x64_mac_hotspot_11.0.9.1_1.tar.gz/jdk-11.0.9.1+1/Contents/Home/bin/java -version:
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode)
Found java executable under /usr/bin/java that resolves to /usr/bin/java
/usr/bin/java -version:
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9.1+1)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode)
No installed java with version 17 found. Will fetch one using coursier.
Coursier: JVM 17 not found in index: No adopt version matching '1.17+' found
Error: Process exited with code 1
Release notes was not shown: not showing release notes since they've already been seen for your current version

After that when I click on "start metals", nothing logs

@tgodzik
Copy link
Contributor

tgodzik commented May 14, 2024

Looks like coursier is actually old and unable to resolve adopt as a default, which does not hava Java 17 indeed.

Does coursier java --jvm temurin:17 -version work for you?

@yadavan88
Copy link

Yes, it does
image

@tgodzik
Copy link
Contributor

tgodzik commented May 14, 2024

ok, this should fix it then #1500

@tgodzik
Copy link
Contributor

tgodzik commented May 14, 2024

You should be able to try it out again.

@smarkess
Copy link

@tgodzik
For 1.31.3 I get the following:

Metals version: 1.2.2
Fetching coursier
Coursier: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Coursier: 0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Coursier: 0     0    0     0    0     0      0      0
Coursier: --:--:-- --:--:-- --:--:--     0
Coursier: 81 19.2M   81 15.6M    0
Coursier: 0  12.8M      0  0:00:01  0:00:01 --:--:-- 12.8M
Coursier: 100 19.2M  100 19.2M    0     0  14.6M
Coursier: 0  0:00:01  0:00:01 --:--:-- 36.3M
Coursier: gzip: (stdin): trailing garbage ignored
Failed to fetch coursier. You may want to try installing coursier manually and adding it to PATH.
Will try to use jar based coursier if Java is available on the machine.
Using coursier located at undefined
/Library/Java/JavaVirtualMachines/corretto-11.0.14/Contents/Home/bin/java -version:
openjdk version "11.0.14" 2022-01-18 LTS
/Library/Java/JavaVirtualMachines/corretto-11.0.14/Contents/Home/bin/java -version:
OpenJDK Runtime Environment Corretto-11.0.14.9.1 (build 11.0.14+9-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.14.9.1 (build 11.0.14+9-LTS, mixed mode)
Found java executable under /usr/bin/java that resolves to /usr/bin/java
/usr/bin/java -version:
openjdk version "11.0.14" 2022-01-18 LTS
/usr/bin/java -version:
OpenJDK Runtime Environment Corretto-11.0.14.9.1 (build 11.0.14+9-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.14.9.1 (build 11.0.14+9-LTS, mixed mode)
Using Java Home: undefined
Error: Cannot resolve Java home or coursier, please provide at least JAVA_HOME.
Release notes was not shown: not showing release notes since they've already been seen for your current version

I have JAVA_HOME setup in both .zshrc and .bash_profile. Also, before (1.29.0) it didn't have problems finding JAVA_HOME. But at the very least it doesn't fail silently like before and instead shows error popup with JAVA_HOME message.

@tgodzik
Copy link
Contributor

tgodzik commented May 14, 2024

@smarkess you can change the version of Java required by Metals to be 11. We try to find 17 by default, which is why we are not picking up the local 11.

"metals.javaVersion": "11"

@smarkess
Copy link

@tgodzik
Yup, that fixed it for me. 1.31.3 now works. Thanks!

@yadavan88
Copy link

yadavan88 commented May 14, 2024

@tgodzik
Still doesnt work for me. It is still failing with adopt 17 error
image

@tgodzik
Copy link
Contributor

tgodzik commented May 14, 2024

As a workaround you can try to update coursier. I will look into what is happening a bit later

@yadavan88
Copy link

Thanks, it works fine after coursier update

@tgodzik
Copy link
Contributor

tgodzik commented May 14, 2024

I missed one place with my previous fix #1503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants