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

VS Code extension on windows initially fails to connect to bloop #1601

Closed
nrktkt opened this issue Apr 10, 2020 · 11 comments
Closed

VS Code extension on windows initially fails to connect to bloop #1601

nrktkt opened this issue Apr 10, 2020 · 11 comments
Labels
needs more information Use if we need more information for a specific ticket
Milestone

Comments

@nrktkt
Copy link
Contributor

nrktkt commented Apr 10, 2020

Describe the bug
After applying a fix for #1600 by setting the mill path to a fixed wrapper, an initial attempt to connect to the server fails. A subsequent attempt succeeds and everything seems to work fine but the user is prompted with a warning notification about limited functionality.

To Reproduce
Steps to reproduce the behavior:

  1. Create a mill project
  2. Open folder containing project in VS Code
  3. Run Metals: Import build
  4. Check output
  5. Check notification area

Expected behavior
No warning is shown, build server successfully connects the first time.

Screenshots
Notification area gives:

Import project partially failed, limited functionality may work in some parts of the workspace. See the logs for more details.

Output gives:

INFO  [148/148] mill.contrib.bloop.BloopImpl.install 
INFO  Failed to connect to server
INFO  build tool exit: 1
INFO  time: ran 'mill bloopInstall' in 1.17s
ERROR Mill command failed: C:\Users\NATHAN~1\AppData\Local\Temp\metals81364211047803705\millw.bat --predef C:\Users\NATHAN~1\AppData\Local\Temp\metals9998593126039946172\predef.sc mill.contrib.Bloop/install
INFO  disconnected: build server
INFO  tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at C:\Users\Nathan Fischer\AppData\Local\scalameta\metals\cache\bsp.trace.json
INFO  time: connected to build server in 0.76s
INFO  Connected to Build server v1.4.0-RC1-105-118a551b
INFO  time: imported build in 0.14s
INFO  time: indexed workspace in 3.34s

Installation:

  • Operating system: Windows 10
  • Editor: Visual Studio Code
  • Metals (extension) version: 1.8.6

Additional context
Running the command (C:\Users\NATHAN~1\AppData\Local\Temp\metals81364211047803705\millw.bat --predef C:\Users\NATHAN~1\AppData\Local\Temp\metals9998593126039946172\predef.sc mill.contrib.Bloop/install) directly in the command prompt works fine, no messages about connecting to the build server are shown.

Search terms
mill vs code bloop warning

@tgodzik
Copy link
Contributor

tgodzik commented Apr 14, 2020

Thanks for reporting! The warning is displayed, because the mill import command fails:
ERROR Mill command failed: C:\Users\NATHAN~1\AppData\Local\Temp\metals81364211047803705\millw.bat --predef C:\Users\NATHAN~1\AppData\Local\Temp\metals9998593126039946172\predef.sc mill.contrib.Bloop/install

Is there any more data in the output about why it failed?

@tgodzik tgodzik added the needs more information Use if we need more information for a specific ticket label Apr 14, 2020
@nrktkt
Copy link
Contributor Author

nrktkt commented Apr 14, 2020

Unfortunately not, only INFO build tool exit: 1.

The only hint we have is that the command is able to run to a successful exit in the command prompt, but not when executed by the plugin.

@tgodzik tgodzik added this to the Metals v0.9 milestone Apr 15, 2020
@tgodzik
Copy link
Contributor

tgodzik commented Apr 15, 2020

I wonder if it might be that in both cases the exit code is actually non zero, but only breaks in Metals? Would it be possible to check?

I will try to run a mill windows slow test, might show some other issues.

@nrktkt
Copy link
Contributor Author

nrktkt commented Apr 15, 2020

%errorlevel% indicates exit code is 0 from the command prompt.

@tgodzik
Copy link
Contributor

tgodzik commented Apr 16, 2020

Testing the integration here: #1632

@tgodzik tgodzik modified the milestones: Metals v0.9, Metals v0.9.1 Apr 30, 2020
@heksesang
Copy link

On Windows, you will get an error code from mill because the default wrapper do not use the -i option and the socket code mill uses for Windows is broken. I use my own wrapper for mill that forces the -i option and have not had the described issue since.

@tgodzik
Copy link
Contributor

tgodzik commented May 18, 2020

@heksesang @kag0 I think this should be fixed in #1715 We now automatically add -i option on windows for the embedded mill script. This should work in latest snapshot

Could you confirm?

@heksesang
Copy link

I cannot confirm that it fails on 0.9.0 because of the error Cannot resolve --mill-version. Try mill resolve _ to see what's available. (confused to why that would appear when it runs the millw.bat wrapper), but for the snapshot version it seems to work fine:

Java home: C:\Users\ginnu\scoop\apps\openjdk11\current
2020.05.18 13:17:28 INFO  logging to file C:\Users\ginnu\Source\tmp\example-1\.metals\metals.log
2020.05.18 13:17:28 INFO  started: Metals version 0.9.0+87-bab412a2-SNAPSHOT in workspace 'C:\Users\ginnu\Source\tmp\example-1'
2020.05.18 13:17:30 INFO  time: initialize in 1.58s
Initializing Scala Debugger
2020.05.18 13:17:32 INFO  no build target: using presentation compiler with only scala-library
2020.05.18 13:17:35 INFO  running 'C:\Users\ginnu\AppData\Local\Temp\metals16507158730204726139\millw.bat --mill-version 0.6.2 -i --predef C:\Users\ginnu\AppData\Local\Temp\metals16507158730204726139\predef.sc mill.contrib.Bloop/install'
2020.05.18 13:18:47 INFO  Compiling C:\Users\ginnu\AppData\Local\Temp\metals16507158730204726139\predef.sc
2020.05.18 13:18:56 INFO  Compiling C:\Users\ginnu\Source\tmp\example-1\build.sc
2020.05.18 13:19:00 INFO  [1/23] foo.sources 
2020.05.18 13:19:00 INFO  [2/23] foo.generatedSources 
2020.05.18 13:19:00 INFO  [3/23] foo.allSources 
2020.05.18 13:19:00 INFO  [4/23] mill.contrib.bloop.BloopImpl.moduleSourceMap 
2020.05.18 13:19:00 INFO  [5/23] foo.unmanagedClasspath 
2020.05.18 13:19:00 INFO  [6/23] foo.scalaVersion 
2020.05.18 13:19:00 INFO  [7/23] foo.platformSuffix 
2020.05.18 13:19:00 INFO  [8/23] foo.compileIvyDeps 
2020.05.18 13:19:00 INFO  [9/23] foo.ivyDeps 
2020.05.18 13:19:00 INFO  [10/23] foo.transitiveIvyDeps 
2020.05.18 13:19:00 INFO  [11/23] foo.scalaOrganization 
2020.05.18 13:19:00 INFO  [12/23] foo.scalaLibraryIvyDeps 
2020.05.18 13:19:00 INFO  [13/23] foo.resources 
2020.05.18 13:19:00 INFO  [14/23] foo.scalacPluginIvyDeps 
2020.05.18 13:19:00 INFO  [15/23] foo.scalacPluginClasspath 
2020.05.18 13:19:00 INFO  [16/23] foo.scalacOptions 
2020.05.18 13:19:00 INFO  [17/23] foo.scalaCompilerClasspath 
2020.05.18 13:19:01 INFO  [18/23] foo.javacOptions 
2020.05.18 13:19:01 INFO  [19/23] foo.forkArgs 
2020.05.18 13:19:01 INFO  [20/23] foo.mainClass 
2020.05.18 13:19:01 INFO  [21/23] foo.bloop.config 
2020.05.18 13:19:01 INFO  [22/23] foo.bloop.writeConfig 
2020.05.18 13:19:01 INFO  Wrote C:\Users\ginnu\Source\tmp\example-1\.bloop\foo.json
2020.05.18 13:19:01 INFO  [23/23] mill.contrib.bloop.BloopImpl.install 
2020.05.18 13:19:01 INFO  build tool exit: 0
2020.05.18 13:19:01 INFO  time: ran 'mill bloopInstall' in 1m26s
2020.05.18 13:19:02 INFO  tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at C:\Users\ginnu\AppData\Local\scalameta\metals\cache\bsp.trace.json
2020.05.18 13:19:02 INFO  time: connected to build server in 0.71s
2020.05.18 13:19:02 INFO  Connected to Build server v1.4.0-RC1-235-3231567a
2020.05.18 13:19:05 INFO  time: indexed workspace in 2.67s

Works fine on another project I am working on as well.

@tgodzik
Copy link
Contributor

tgodzik commented May 18, 2020

@heksesang Thanks!

@nrktkt
Copy link
Contributor Author

nrktkt commented May 19, 2020

Snapshot works for me!
I also get the error from --mill-version with the default wrapper script on 0.9.0 fwiw.

@tgodzik
Copy link
Contributor

tgodzik commented May 19, 2020

Thanks! Closing it, since the fix is confirmed.

@tgodzik tgodzik closed this as completed May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more information Use if we need more information for a specific ticket
Projects
None yet
Development

No branches or pull requests

3 participants