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 fails to compile project with a Bloop error report #6999

Closed
ghostdogpr opened this issue Dec 2, 2024 · 7 comments · Fixed by scalacenter/bloop#2527
Closed

Metals fails to compile project with a Bloop error report #6999

ghostdogpr opened this issue Dec 2, 2024 · 7 comments · Fixed by scalacenter/bloop#2527
Labels
bloop Bloop related tickets upstream-fix-needed Waiting on a fix upstream
Milestone

Comments

@ghostdogpr
Copy link

Describe the bug

I am trying to load and compile a work project in VS Code with Metals (can't share the sources unfortunately).
It fails on one of the first modules with no errors reported.

The Metals output just says something like 2024.12.02 19:35:27 INFO time: compiled serviceProtocol in 0.86s but it doesn't continue to the next module.

There's this warning:
Screenshot 2024-12-02 at 19 38 42

When running Doctor the module appears like this:
Screenshot 2024-12-02 at 19 39 45

There is nothing in the Problems tab. There is a Bloop error report though:
Screenshot 2024-12-02 at 19 41 01

Here's the full stack trace in the report:

### Bloop error:

java.nio.file.NoSuchFileException: <WORKSPACE>/ck-service-protocol/target/scala-3.5.2/early/serviceprotocol_3-6.0.0.jar
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:261)
	at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:482)
	at java.base/java.nio.file.Files.newOutputStream(Files.java:227)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:162)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getZipFileSystem(ZipFileSystemProvider.java:125)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:106)
	at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:339)
	at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:288)
	at dotty.tools.io.JarArchive$.open(JarArchive.scala:39)
	at dotty.tools.io.JarArchive$.create(JarArchive.scala:27)
	at dotty.tools.dotc.config.Settings$Setting.output$1(Settings.scala:201)
	at dotty.tools.dotc.config.Settings$Setting.setOutput$1$$anonfun$1(Settings.scala:202)
	at dotty.tools.dotc.config.Settings$Setting.update$1(Settings.scala:143)
	at dotty.tools.dotc.config.Settings$Setting.setOutput$1(Settings.scala:202)
	at dotty.tools.dotc.config.Settings$Setting.doSetArg$1(Settings.scala:247)
	at dotty.tools.dotc.config.Settings$Setting.doSet$1(Settings.scala:234)
	at dotty.tools.dotc.config.Settings$Setting.tryToSet(Settings.scala:265)
	at dotty.tools.dotc.config.Settings$SettingGroup.loop$1(Settings.scala:358)
	at dotty.tools.dotc.config.Settings$SettingGroup.processArguments(Settings.scala:363)
	at dotty.tools.dotc.config.Settings$SettingGroup.processArguments(Settings.scala:370)
	at dotty.tools.dotc.config.CliCommand.distill(CliCommand.scala:52)
	at dotty.tools.dotc.config.CliCommand.distill$(CliCommand.scala:13)
	at dotty.tools.dotc.config.CompilerCommand.distill(CompilerCommand.scala:7)
	at dotty.tools.dotc.Driver.setup(Driver.scala:81)
	at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:131)
	at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.compileSources$1(BloopHighLevelCompiler.scala:148)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$9(BloopHighLevelCompiler.scala:181)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$1(BloopHighLevelCompiler.scala:73)
	at bloop.tracing.NoopTracer$.trace(BraveTracer.scala:53)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.timed$1(BloopHighLevelCompiler.scala:72)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$8(BloopHighLevelCompiler.scala:181)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at monix.eval.internal.TaskRunLoop$.startFull(TaskRunLoop.scala:81)
	at monix.eval.internal.TaskRestartCallback.syncOnSuccess(TaskRestartCallback.scala:101)
	at monix.eval.internal.TaskRestartCallback.onSuccess(TaskRestartCallback.scala:74)
	at monix.eval.internal.TaskExecuteOn$AsyncRegister$$anon$1.run(TaskExecuteOn.scala:71)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
#### Short summary: 

java.nio.file.NoSuchFileException: <WORKSPACE>/ck-service-protocol/target/scala-3.5.2/early/servicep...

Note that I tried it on 2 different machines (both Mac) for the same result.

Expected behavior

The project compiles successfully.

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

v1.4.1

Extra context or search terms

Metals Java: 21.0.5 from Eclipse Adoptium
Metals Server version: 1.4.1
Project's Java: 21.0.5
Build definition is coming from sbt
Build server currently being used is Bloop v2.0.5

@tgodzik
Copy link
Contributor

tgodzik commented Dec 2, 2024

Thanks! Looks like this error was caused by the previous one Unexpected error while compiling serviceProtocol, are you able to provide that stack trace as well.

Looks like two issues:

  • the compiler is crashing and not producing the jars
  • compilation is anyway progressing for another module despite serviceProtocol not being compiled

@tgodzik tgodzik added the needs more information Use if we need more information for a specific ticket label Dec 2, 2024
@ghostdogpr
Copy link
Author

Ah it's just the same thing:

### Bloop error:

Unexpected error when compiling serviceProtocol: java.nio.file.NoSuchFileException: <WORKSPACE>/ck-service-protocol/target/scala-3.5.2/early/serviceprotocol_3-6.0.0.jar
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:261)
	at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:482)
	at java.base/java.nio.file.Files.newOutputStream(Files.java:227)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:162)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getZipFileSystem(ZipFileSystemProvider.java:125)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:106)
	at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:339)
	at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:288)
	at dotty.tools.io.JarArchive$.open(JarArchive.scala:39)
	at dotty.tools.io.JarArchive$.create(JarArchive.scala:27)
	at dotty.tools.dotc.config.Settings$Setting.output$1(Settings.scala:201)
	at dotty.tools.dotc.config.Settings$Setting.setOutput$1$$anonfun$1(Settings.scala:202)
	at dotty.tools.dotc.config.Settings$Setting.update$1(Settings.scala:143)
	at dotty.tools.dotc.config.Settings$Setting.setOutput$1(Settings.scala:202)
	at dotty.tools.dotc.config.Settings$Setting.doSetArg$1(Settings.scala:247)
	at dotty.tools.dotc.config.Settings$Setting.doSet$1(Settings.scala:234)
	at dotty.tools.dotc.config.Settings$Setting.tryToSet(Settings.scala:265)
	at dotty.tools.dotc.config.Settings$SettingGroup.loop$1(Settings.scala:358)
	at dotty.tools.dotc.config.Settings$SettingGroup.processArguments(Settings.scala:363)
	at dotty.tools.dotc.config.Settings$SettingGroup.processArguments(Settings.scala:370)
	at dotty.tools.dotc.config.CliCommand.distill(CliCommand.scala:52)
	at dotty.tools.dotc.config.CliCommand.distill$(CliCommand.scala:13)
	at dotty.tools.dotc.config.CompilerCommand.distill(CompilerCommand.scala:7)
	at dotty.tools.dotc.Driver.setup(Driver.scala:81)
	at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:131)
	at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.compileSources$1(BloopHighLevelCompiler.scala:148)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$9(BloopHighLevelCompiler.scala:181)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$1(BloopHighLevelCompiler.scala:73)
	at bloop.tracing.NoopTracer$.trace(BraveTracer.scala:53)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.timed$1(BloopHighLevelCompiler.scala:72)
	at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$8(BloopHighLevelCompiler.scala:181)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at monix.eval.internal.TaskRunLoop$.startFull(TaskRunLoop.scala:81)
	at monix.eval.internal.TaskRestartCallback.syncOnSuccess(TaskRestartCallback.scala:101)
	at monix.eval.internal.TaskRestartCallback.onSuccess(TaskRestartCallback.scala:74)
	at monix.eval.internal.TaskExecuteOn$AsyncRegister$$anon$1.run(TaskExecuteOn.scala:71)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
#### Short summary: 

Unexpected error when compiling serviceProtocol: java.nio.file.NoSuchFileException: <WORKSPACE>/ck-s...

There's no error in the logs, it shows like this:

2024.12.02 19:35:27 INFO  compiling serviceprotocol (243 scala sources)
2024.12.02 19:35:27 INFO  time: compiled serviceProtocol in 0.86s

And nothing else is happening.

@tgodzik
Copy link
Contributor

tgodzik commented Dec 2, 2024

Anything special how serviceprotocol is used? This looks like the module requires itself to be built? Or is it a same named dependency?

I think we need to add more data to the exceptions there.

@tgodzik tgodzik added upstream-fix-needed Waiting on a fix upstream bloop Bloop related tickets and removed needs more information Use if we need more information for a specific ticket labels Dec 2, 2024
@tgodzik
Copy link
Contributor

tgodzik commented Dec 2, 2024

Or just filter out anything that doesn't exist on the classpath? 🤔

@ghostdogpr
Copy link
Author

2 things I can add:

  • I tried on 2 different computers, I got the same error but not on the same module. On one computer it was serviceProtocol (which doesn't depend on any other module), on the other computer the error was on the next module (that depends on serviceProtocol).
  • serviceProtocol makes use of code generation (ScalaPB), compiling it generates some code in the "sourceManaged" folder which is then compiled. But I didn't suspect that to be a cause because of the previous point (the other module doesn't have any code generation at all, it's just plain scala code).

@ghostdogpr
Copy link
Author

Damn, I found the cause!

ThisBuild / usePipelining := true

I was looking at my build.sbt in case there was anything out of the ordinary and noticed we are using build pipelining. Tried to change it to false and the issue disappears.

@tgodzik
Copy link
Contributor

tgodzik commented Dec 2, 2024

Och, that's a good catch! I wonder what changes if it's set to true. I can investigate more now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bloop Bloop related tickets upstream-fix-needed Waiting on a fix upstream
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants