Skip to content

References to another project causing issues in current project (stale Bloop stuff?) #5279

Open
@ckipp01

Description

@ckipp01

Describe the bug

So I originally hit on a very similiar issue to this with scala-cli and created an issue for it here, although I'm starting to think the issue actually lays deeper in Bloop. I'll create here to try and diagnose whether it's an issue with Bloop or maybe with Metals somehow, but my gut tells me Bloop.

The issue I linked about hints at Bloop holding onto some stale state and this seems to be the same case again. It's hard to reproduce, but let me outline how this happened for me. I was working on the coursier codebase and triggered a full clean compile. When looking at the logs I saw:

2023.05.27 12:19:45 INFO  time: compiled interop.cats.js[2.13.6] in 2.01s
May 27, 2023 12:19:56 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleNotification
WARNING: Notification threw an exception: {
  "jsonrpc": "2.0",
  "method": "build/publishDiagnostics",
  "params": {
    "textDocument": {
      "uri": "file:///Users/ckipp/Documents/scala-workspace/dotty/warning:%5Boptions%5D%20bootstrap%20class%20path%20not%20set%20in%20conjunction%20with%20-source%208%0A/Users/ckipp/Documents/scala-workspace/coursier/modules/cache/jvm/src/main/java/coursier/cache/internal/SigWinch.java"
    },
    "buildTarget": {
      "uri": "file:/Users/ckipp/Documents/scala-workspace/coursier/modules/cache/jvm/?id\u003dcache.jvm[2.13.6]"
    },
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 2,
            "character": 0
          },
          "end": {
            "line": 2,
            "character": 0
          }
        },
        "severity": 2,
        "source": "bloop",
        "message": " Signal is internal proprietary API and may be removed in a future release"
      }
    ],
    "reset": true
  }
}
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152)
        at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
        at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
        at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
        at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
        at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        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:833)
Caused by: java.lang.reflect.InvocationTargetException
        at jdk.internal.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
        ... 11 more
Caused by: java.nio.file.NoSuchFileException: /Users/ckipp/Documents/scala-workspace/dotty/warning:[options] bootstrap class path not set in conjunction with -source 8
/Users/ckipp/Documents/scala-workspace/coursier/modules/cache/jvm/src/main/java/coursier/cache/internal/SigWinch.java
        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:218)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:432)
        at java.base/java.nio.file.Files.readAllBytes(Files.java:3288)
        at scala.meta.internal.io.PlatformFileIO$.slurp(PlatformFileIO.scala:45)
        at scala.meta.internal.io.FileIO$.slurp(FileIO.scala:24)
        at scala.meta.internal.mtags.ScalametaCommonEnrichments$XtensionAbsolutePath.toInput(ScalametaCommonEnrichments.scala:378)
        at scala.meta.internal.metals.Diagnostics.onPublishDiagnostics(Diagnostics.scala:166)
        at scala.meta.internal.metals.Diagnostics.onBuildPublishDiagnostics(Diagnostics.scala:146)
        at scala.meta.internal.metals.clients.language.ForwardingMetalsBuildClient.onBuildPublishDiagnostics(ForwardingMetalsBuildClient.scala:110)
        ... 15 more

2023.05.27 12:19:59 INFO  compiling interop.cats.jvm[2.13.6] (2 scala sources)
2023.05.27 12:19:59 INFO  compiling interop.scalaz.jvm[2.13.6] (2 scala sources)

Notice that right between the logs about certain modules being compiled I get an error thrown by the build server about a URI found in my local dotty codebase. That project isn't open, and shouldn't be appearing in the workspace logs of another project.

Expected behavior

I would never expect any reference to another project to appear and be causing issue in another project.

Operating system

macOS

Editor/Extension

Nvim (nvim-metals)

Version of Metals

0.11.12+77-cce28f19-SNAPSHOT

Extra context or search terms

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that is making a piece of functionality unusableupstream-fix-neededWaiting on a fix upstream

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions