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 crashed when used in LSP4IJ #7073

Open
tribbloid opened this issue Dec 28, 2024 · 3 comments
Open

metals crashed when used in LSP4IJ #7073

tribbloid opened this issue Dec 28, 2024 · 3 comments
Labels
bloop Bloop related tickets upstream-fix-needed Waiting on a fix upstream

Comments

@tribbloid
Copy link

Describe the bug

when opening the splain plugin:

https://github.com/tek/splain (master branch)

I got the following error:

2024.12.28 04:02:45 INFO  logging to files /home/peng/git/shapesafe/splain/.metals/metals.log
2024.12.28 04:02:45 INFO  Started: Metals version 1.4.2 in folders '/home/peng/git/shapesafe/splain' for client IntelliJ IntelliJ IDEA (build IC-243.22562.218).
2024.12.28 04:02:47 INFO  Database: jdbc:h2:file:/home/peng/git/shapesafe/splain/.metals/metals (H2 2.3)
2024.12.28 04:02:47 INFO  Successfully validated 6 migrations (execution time 00:00.102s)
2024.12.28 04:02:47 INFO  Current version of schema "PUBLIC": 6
2024.12.28 04:02:47 INFO  Schema "PUBLIC" is up to date. No migration necessary.
2024.12.28 04:02:47 INFO  Attempting to connect to the build server...
2024.12.28 04:02:47 INFO  Found a Bloop server running
2024.12.28 04:02:47 INFO  Database: jdbc:h2:file:/tmp/fallback-service683125097586318347/.metals/metals (H2 2.3)
2024.12.28 04:02:47 INFO  Schema history table "PUBLIC"."flyway_schema_history" does not exist yet
2024.12.28 04:02:47 INFO  Successfully validated 6 migrations (execution time 00:00.024s)
2024.12.28 04:02:47 INFO  Creating Schema History table "PUBLIC"."flyway_schema_history" ...
2024.12.28 04:02:48 INFO  tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at /home/peng/git/shapesafe/splain/.metals/bsp.trace.json or /home/peng/.cache/metals/bsp.trace.json
2024.12.28 04:02:48 INFO  Current version of schema "PUBLIC": << Empty Schema >>
2024.12.28 04:02:48 INFO  Migrating schema "PUBLIC" to version "1 - Create tables"
2024.12.28 04:02:48 INFO  Migrating schema "PUBLIC" to version "2 - Server discovery"
2024.12.28 04:02:48 INFO  Migrating schema "PUBLIC" to version "3 - Jar symbols"
2024.12.28 04:02:47 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-compiler/2.13.6/22973a59257545499e15c6e7f6332ce201c87a8/scala-compiler-2.13.6.jar doesn't exist!
2024.12.28 04:02:47 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.jline/jline/3.19.0/27edf6497c4fac20b63ca4cd8788581ca86cb83e/jline-3.19.0.jar doesn't exist!
2024.12.28 04:02:47 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/net.java.dev.jna/jna/5.3.1/6eb9d07456c56b9c2560722e90382252f0f98405/jna-5.3.1.jar doesn't exist!
2024.12.28 04:02:48 INFO  Migrating schema "PUBLIC" to version "4 - Fingerprints"
2024.12.28 04:02:47 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-compiler/2.13.6/22973a59257545499e15c6e7f6332ce201c87a8/scala-compiler-2.13.6.jar doesn't exist!
2024.12.28 04:02:47 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.jline/jline/3.19.0/27edf6497c4fac20b63ca4cd8788581ca86cb83e/jline-3.19.0.jar doesn't exist!
2024.12.28 04:02:47 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/net.java.dev.jna/jna/5.3.1/6eb9d07456c56b9c2560722e90382252f0f98405/jna-5.3.1.jar doesn't exist!
2024.12.28 04:02:47 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.13.13/3b1434403ddb147b8030f98f246153e4ce622c78/scala-library-2.13.13.jar doesn't exist!
2024.12.28 04:02:47 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.jline/jline/3.24.1/babbac968fafe76884b0cf41124569e8bc004d04/jline-3.24.1.jar doesn't exist!
2024.12.28 04:02:47 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.13.13/3b1434403ddb147b8030f98f246153e4ce622c78/scala-library-2.13.13.jar doesn't exist!
2024.12.28 04:02:47 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.jline/jline/3.24.1/babbac968fafe76884b0cf41124569e8bc004d04/jline-3.24.1.jar doesn't exist!
2024.12.28 04:02:48 INFO  Migrating schema "PUBLIC" to version "5 - Jar type hierarchy"
2024.12.28 04:02:48 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.13.13/3b1434403ddb147b8030f98f246153e4ce622c78/scala-library-2.13.13.jar doesn't exist!
2024.12.28 04:02:48 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.13.13/3b1434403ddb147b8030f98f246153e4ce622c78/scala-library-2.13.13.jar doesn't exist!
2024.12.28 04:02:48 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.jline/jline/3.24.1/babbac968fafe76884b0cf41124569e8bc004d04/jline-3.24.1.jar doesn't exist!
2024.12.28 04:02:48 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.jline/jline/3.24.1/babbac968fafe76884b0cf41124569e8bc004d04/jline-3.24.1.jar doesn't exist!
2024.12.28 04:02:48 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.13.13/3b1434403ddb147b8030f98f246153e4ce622c78/scala-library-2.13.13.jar doesn't exist!
2024.12.28 04:02:48 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.jline/jline/3.24.1/babbac968fafe76884b0cf41124569e8bc004d04/jline-3.24.1.jar doesn't exist!
2024.12.28 04:02:48 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.13.13/3b1434403ddb147b8030f98f246153e4ce622c78/scala-library-2.13.13.jar doesn't exist!
2024.12.28 04:02:48 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.jline/jline/3.24.1/babbac968fafe76884b0cf41124569e8bc004d04/jline-3.24.1.jar doesn't exist!
2024.12.28 04:02:48 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.13.13/3b1434403ddb147b8030f98f246153e4ce622c78/scala-library-2.13.13.jar doesn't exist!
2024.12.28 04:02:48 WARN  Scala instance jar /home/peng/.gradle/caches/modules-2/files-2.1/org.jline/jline/3.24.1/babbac968fafe76884b0cf41124569e8bc004d04/jline-3.24.1.jar doesn't exist!
2024.12.28 04:02:48 INFO  Migrating schema "PUBLIC" to version "6 - Delete indices"
2024.12.28 04:02:48 ERROR Bloop server PID: 29775
Ignoring SIGINT
Will truncate output file /home/peng/.local/share/scalacli/bloop/daemon/output every 5 minutes
SLF4J(I): Connected with provider of type [ch.qos.logback.classic.spi.LogbackServiceProvider]
Unable to load nailgun-version.properties.
NGServer [UNKNOWN] started on local socket /home/peng/.local/share/scalacli/bloop/daemon/socket.
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop
/home/peng/.local/share/scalacli/bloop

2024.12.28 04:02:48 INFO  Successfully applied 6 migrations to schema "PUBLIC", now at version v6 (execution time 00:00.280s)
2024.12.28 04:02:48 ERROR Failed to connect with build server, no functionality will work.
java.util.concurrent.ExecutionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: bloop.data.Project$ProjectReadException: Failed to load project from /home/peng/git/shapesafe/splain/.bloop/splain-testFixtures.json
	at bloop.data.Project$.fromBytesAndOrigin(Project.scala:276)
	at bloop.engine.BuildLoader$.loadProject(BuildLoader.scala:264)
	at bloop.engine.BuildLoader$.$anonfun$loadBuildIncrementally$3(BuildLoader.scala:59)
	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.TaskShift$Register$$anon$1.run(TaskShift.scala:65)
	at monix.execution.internal.InterceptRunnable.run(InterceptRunnable.scala:27)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.nio.file.NoSuchFileException: /home/peng/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-compiler/2.13.6/22973a59257545499e15c6e7f6332ce201c87a8/scala-compiler-2.13.6.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.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
	at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:148)
	at java.base/sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
	at java.base/java.nio.file.Files.readAttributes(Files.java:1851)
	at bloop.ScalaInstance.$anonfun$hashCode$1(ScalaInstance.scala:114)
	at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:286)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:38)
	at scala.collection.TraversableLike.map(TraversableLike.scala:286)
	at scala.collection.TraversableLike.map$(TraversableLike.scala:279)
	at scala.collection.AbstractTraversable.map(Traversable.scala:108)
	at bloop.ScalaInstance.<init>(ScalaInstance.scala:110)
	at bloop.ScalaInstance$.newInstance$1(ScalaInstance.scala:198)
	at bloop.ScalaInstance$.$anonfun$apply$9(ScalaInstance.scala:204)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
	at bloop.ScalaInstance$.apply(ScalaInstance.scala:204)
	at bloop.data.Project$.$anonfun$fromConfig$1(Project.scala:298)
	at scala.Option.flatMap(Option.scala:271)
	at bloop.data.Project$.fromConfig(Project.scala:287)
	at bloop.data.Project$.fromBytesAndOrigin(Project.scala:270)
	... 10 more

	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
	at scala.meta.internal.metals.BuildServerConnection$.initialize(BuildServerConnection.scala:755)
	at scala.meta.internal.metals.BuildServerConnection$.$anonfun$fromSockets$1(BuildServerConnection.scala:630)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(Thread.java:840)
Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: bloop.data.Project$ProjectReadException: Failed to load project from /home/peng/git/shapesafe/splain/.bloop/splain-testFixtures.json
	at bloop.data.Project$.fromBytesAndOrigin(Project.scala:276)
	at bloop.engine.BuildLoader$.loadProject(BuildLoader.scala:264)
	at bloop.engine.BuildLoader$.$anonfun$loadBuildIncrementally$3(BuildLoader.scala:59)
	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.TaskShift$Register$$anon$1.run(TaskShift.scala:65)
	at monix.execution.internal.InterceptRunnable.run(InterceptRunnable.scala:27)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.nio.file.NoSuchFileException: /home/peng/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-compiler/2.13.6/22973a59257545499e15c6e7f6332ce201c87a8/scala-compiler-2.13.6.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.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
	at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:148)
	at java.base/sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
	at java.base/java.nio.file.Files.readAttributes(Files.java:1851)
	at bloop.ScalaInstance.$anonfun$hashCode$1(ScalaInstance.scala:114)
	at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:286)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:38)
	at scala.collection.TraversableLike.map(TraversableLike.scala:286)
	at scala.collection.TraversableLike.map$(TraversableLike.scala:279)
	at scala.collection.AbstractTraversable.map(Traversable.scala:108)
	at bloop.ScalaInstance.<init>(ScalaInstance.scala:110)
	at bloop.ScalaInstance$.newInstance$1(ScalaInstance.scala:198)
	at bloop.ScalaInstance$.$anonfun$apply$9(ScalaInstance.scala:204)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
	at bloop.ScalaInstance$.apply(ScalaInstance.scala:204)
	at bloop.data.Project$.$anonfun$fromConfig$1(Project.scala:298)
	at scala.Option.flatMap(Option.scala:271)
	at bloop.data.Project$.fromConfig(Project.scala:287)
	at bloop.data.Project$.fromBytesAndOrigin(Project.scala:270)
	... 10 more

	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:220)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:204)
	at scala.meta.internal.metals.RequestMonitorImpl$$anon$1.consume(ServerLivenessMonitor.scala:41)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:185)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:97)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:114)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(Thread.java:840)

2024.12.28 04:02:49 INFO  no build target found for /home/peng/git/shapesafe/splain/core/src/main/scala-2.13.7+/latest/splain/SplainFormattersExtension.scala. Using presentation compiler with project's scala-library version: 3.3.4
2024.12.28 04:02:52 INFO  Selected port 5031
2024.12.28 04:02:52 INFO  Started Metals http server at http://127.0.0.1:5031
2024.12.28 04:02:54 INFO  no build target found for /home/peng/git/shapesafe/splain/core/src/main/scala/splain/PluginSettings.scala. Using presentation compiler with project's scala-library version: 3.3.4
2024.12.28 04:02:54 INFO  time: code lens generation in 6.17s
2024.12.28 04:02:55 INFO  no build target found for /home/peng/git/shapesafe/splain/core/src/main/scala-2.13.7+/latest/splain/SplainFormattingExtension.scala. Using presentation compiler with project's scala-library version: 3.3.4
2024.12.28 04:02:56 INFO  no build target found for /home/peng/git/shapesafe/splain/core/src/main/scala-2.13.7+/latest/splain/TyperCompatViews.scala. Using presentation compiler with project's scala-library version: 3.3.4
2024.12.28 04:02:56 INFO  no build target found for /home/peng/git/shapesafe/splain/core/src/main/scala-2.13.7+/latest/splain/SplainAnalyzer.scala. Using presentation compiler with project's scala-library version: 3.3.4
2024.12.28 04:03:01 INFO  no build target found for /home/peng/git/shapesafe/splain/core/src/main/scala/splain/PluginSettings.scala. Using presentation compiler with project's scala-library version: 3.3.4

It looks strange as the gradle project is set to use Scala 2.13.15, yet the NoSuchFileException is triggered by Scala 2.13.6

Expected behavior

should be launched successfully

Operating system

Linux

Editor/Extension

Other

Version of Metals

1.4.2

Extra context or search terms

No response

@tgodzik
Copy link
Contributor

tgodzik commented Dec 30, 2024

Thanks for reporting! Looks like the caches were removed and a reimport is needed in that case. Not sure how to fix that properly. Maybe we should add some fallbacks based on the version? But any idea why those are no longer available?

@tgodzik tgodzik added upstream-fix-needed Waiting on a fix upstream bloop Bloop related tickets labels Dec 30, 2024
@tribbloid
Copy link
Author

they are probably deleted in the previous gradle clean.

can this happen automatically in case of a version upgrade or disk corruption?

@tgodzik
Copy link
Contributor

tgodzik commented Dec 31, 2024

can this happen automatically in case of a version upgrade or disk corruption?

Not sure, but it's managed by gradle, so ideally we would need to get jar locations that are reliant on it. I have some ideas of how to improve it, but nothing perfect.

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

No branches or pull requests

2 participants