scalacenter / bloop

Bloop is a build server and CLI tool to compile, test and run Scala fast from any editor or build tool.
https://scalacenter.github.io/bloop/
Apache License 2.0
902 stars 202 forks source link

Bloop launcher stuck on Appveyor CI #790

Closed olafurpg closed 5 years ago

olafurpg commented 5 years ago

To reproduce

I have an appveyor.yml like this in Metals.

build_script:
  - java -Djna.nosys=true -jar metals\src\main\resources\bloop-launch.jar --skip-bsp-connection 1.2.1
  - sbt publishLocal

It gets stuck at the following line https://ci.appveyor.com/project/scalameta/metals#L230

Sleeping for 400ms until we run `bloop about` to check server

PR: https://github.com/scalameta/metals/pull/462

olafurpg commented 5 years ago

Without -Djna.nosys=true, I get the following error

ception in thread "main" java.lang.Error: 
There is an incompatible JNA native library installed on this system
Expected: 5.2.0
Found:    3.2.1
C:\Program Files\Java\jdk1.8.0\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:\sbt\bin;C:\Program Files\Java\jdk1.8.0\bin;C:\Program Files\Java\jdk1.8.0\bin;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Perl\site\bin;C:\Perl\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\7-Zip;C:\Program Files\Microsoft\Web Platform Installer\;C:\Tools\GitVersion;C:\Tools\PsTools;C:\Program Files\Git LFS;C:\Program Files (x86)\Subversion\bin;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Tools\WebDriver;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.4\;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\wbin;C:\Ruby193\bin;C:\Tools\NUnit\bin;C:\Tools\xUnit;C:\Tools\MSpec;C:\Tools\Coverity\bin;C:\Program Files (x86)\CMake\bin;C:\go\bin;C:\Program Files\Java\jdk1.8.0\bin;C:\Python27;C:\Program Files\nodejs;C:\Program Files (x86)\iojs;C:\Program Files\iojs;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\MSBuild\14.0\Bin;C:\Tools\NuGet;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Apache\Maven\bin;C:\Python27\Scripts;C:\Tools\NUnit3;C:\Program Files\Mercurial\;C:\Program Files\dotnet\;C:\Tools\curl\bin;C:\Program Files\Amazon\AWSCLI\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\140;C:\Tools\vcpkg;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files\erl9.2\bin;C:\Program Files (x86)\NSIS;C:\Tools\Octopus;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\LLVM\bin;C:\Program Files (x86)\Yarn\bin\;C:\Users\appveyor\AppData\Roaming\npm;C:\Program Files\PowerShell\6\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\nodejs\;C:\Users\appveyor\.dotnet\tools;C:\Users\appveyor\AppData\Local\Yarn\bin;C:\Users\appveyor\AppData\Roaming\npm;C:\Program Files\AppVeyor\BuildAgent\;..
To resolve this issue you may do one of the following:
 - remove or uninstall the offending library
 - set the system property jna.nosys=true
 - set jna.boot.library.path to include the path to the version of the 
   jnidispatch library included with the JNA jar file you are using
    at com.sun.jna.Native.<clinit>(Native.java:199)
    at com.sun.jna.Pointer.<clinit>(Pointer.java:54)

It might be related but I'm not sure.

olafurpg commented 5 years ago

Here is more information from the logs, most interestingly install.py failed to run.

Starting the bsp launcher for bloop...
java.lang.RuntimeException: CreateProcessW() failed, error: 2
    at com.zaxxer.nuprocess.windows.WindowsProcess.start(WindowsProcess.java:248)
    at com.zaxxer.nuprocess.windows.WinProcessFactory.createProcess(WinProcessFactory.java:42)
    at com.zaxxer.nuprocess.NuProcessBuilder.start(NuProcessBuilder.java:266)
    at bloop.launcher.core.Shell.runCommand(Shell.scala:87)
    at bloop.launcher.core.Shell.detectBloopInSystemPath(Shell.scala:153)
    at bloop.launcher.LauncherMain.detectServerState(Launcher.scala:232)
    at bloop.launcher.LauncherMain.connectToBloopBspServer(Launcher.scala:159)
    at bloop.launcher.LauncherMain.runLauncher(Launcher.scala:95)
    at bloop.launcher.LauncherMain.cli(Launcher.scala:78)
    at bloop.launcher.LauncherMain.main(Launcher.scala:59)
    at bloop.launcher.Launcher.main(Launcher.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at coursier.bootstrap.Bootstrap.main(Unknown Source)
Bloop is not available in the machine, installing bloop 1.2.1...
Downloading installer at https://github.com/scalacenter/bloop/releases/download/v1.2.1/install.py...
error: Failed to run 'python C:\Users\appveyor\AppData\Local\Temp\1\bsp-launcher3823799065558849246\install.py --dest C:\Users\appveyor\.bloop'
> Error while downloading https://oss.sonatype.org/content/repositories/releases/io/get-coursier/coursier-cli_2.12/1.1.0-M8/coursier-cli_2.12-1.1.0-M8-standalone.jar: C:\Users\appveyor\AppData\Local\Coursier\cache\v1\https\oss.sonatype.org\content\repositories\releases\io\get-coursier\coursier-cli_2.12\1.1.0-M8\coursier-cli_2.12-1.1.0-M8-standalone.jar.part -> C:\Users\appveyor\AppData\Local\Coursier\cache\v1\https\oss.sonatype.org\content\repositories\releases\io\get-coursier\coursier-cli_2.12\1.1.0-M8\coursier-cli_2.12-1.1.0-M8-standalone.jar, ignoring it
> Downloading Bloop's coursier version, this may take some seconds...
> Coursier couldn't create C:\Users\appveyor\.bloop\blp-server. Please report an issue.
> Command: ['java', '-jar', 'C:\\Users\\appveyor\\.bloop\\blp-coursier', 'bootstrap', 'ch.epfl.scala:bloop-frontend_2.12:1.2.1', '-r', 'bintray:scalameta/maven', '-r', 'bintray:scalacenter/releases', '-r', 'https://oss.sonatype.org/content/repositories/staging', '-o', 'C:\\Users\\appveyor\\.bloop\\blp-server', '-f', '--standalone', '--main', 'bloop.Server']
> Return code: 255
The launcher will now try to resolve bloop and spawn an embedded build server...
Resolving ch.epfl.scala:bloop-frontend_2.12:1.2.1...
error: Fetch error(s):
not found: https://repo1.maven.org/maven2/io/get-coursier/coursier_2.12/1.1.0-M8/coursier_2.12-1.1.0-M8.jar
INFO  bloop-launch.jar exit: 1
INFO  tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at C:\Users\appveyor\AppData\Local\scalameta\metals\cache\bsp.trace.json
ERROR Timeout waiting for 'build/initialize' response
ERROR Failed to connect with build server, no functionality will work.
java.util.concurrent.TimeoutException
    at java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1771)
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
jvican commented 5 years ago

I have:

However, I cannot reproduce on a Windows 10 machine with Java 8.

Important considerations:

  1. I have not had any problem with jna (why is the jna issue happening to you?)
  2. I run the launcher in an environment with no bloop installed (just as appveyor)
  3. The launcher installs bloop successfully
  4. The script finishes after 6 "Sleeping for 400ms until we run bloop about to check server" logs
  5. Script finishes with a 0 exit status code

I would copy the logs but couldn't figure out how to share logs from a Windows VM to my machine.

jvican commented 5 years ago

I'm closing since I couldn't reproduce. Let's open again when a reproduction is found and I can I investigate further