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

Bloop libdaemonjvm.server.LockError$ZombieFound when Coursier cache is in an inconsistent state #2899

Open
kavedaa opened this issue May 9, 2024 · 3 comments
Labels
Bloop Issues tied with Bloop integration. bug Something isn't working

Comments

@kavedaa
Copy link

kavedaa commented May 9, 2024

Version(s)

>scala-cli --version
Scala CLI version: 1.3.1
Scala version (default): 3.4.1

Describe the bug

When attempting to compile a .scala file using scala-cli, it fails with Error: bloop.rifle.FailedToStartServerExitCodeException: Server failed with exit code 1

To Reproduce

test.scala:

@main def hello() = println("Hello world")

Run:

scala-cli test.scala

Output:

Starting compilation server
Error: bloop.rifle.FailedToStartServerExitCodeException: Server failed with exit code 1
For more details, please see 'E:\prog\scala\2024-05-09\.scala-build\stacktraces\1715261914-11874568566794901524.log'
Running
  C:\Program Files\scala-cli-x86_64-pc-win32\scala-cli.exe --power bloop output
might give more details.

Log file:

bloop.rifle.FailedToStartServerExitCodeException: Server failed with exit code 1
  bloop.rifle.internal.Operations$.$anonfun$startServer$8(Operations.scala:264)
  bloop.rifle.BloopRifleLogger.$anonfun$runnable$1(BloopRifleLogger.scala:14)
  java.base@17.0.6/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
  java.base@17.0.6/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
  java.base@17.0.6/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
  java.base@17.0.6/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
  java.base@17.0.6/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
  java.base@17.0.6/java.lang.Thread.run(Thread.java:833)
  com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
  com.oracle.svm.core.windows.WindowsPlatformThreads.osThreadStartRoutine(WindowsPlatformThreads.java:178)

Output of scala-cli.exe --power bloop output:

>scala-cli --power bloop output
Bloop server PID: 25616
Ignoring SIGINT
Will truncate output file C:\Users\Knut Arne Vedaa\AppData\Local\ScalaCli\data\bloop\daemon\output every 5 minutes
Caught libdaemonjvm.server.LockError$ZombieFound: Cannot connect to process 2696, trying again in 3 seconds
Caught libdaemonjvm.server.LockError$ZombieFound: Cannot connect to process 2696, trying again in 3 seconds
Caught libdaemonjvm.server.LockError$ZombieFound: Cannot connect to process 2696, trying again in 3 seconds
Caught libdaemonjvm.server.LockError$ZombieFound: Cannot connect to process 2696, trying again in 3 seconds
Caught libdaemonjvm.server.LockError$ZombieFound: Cannot connect to process 2696, trying again in 3 seconds
Caught libdaemonjvm.server.LockError$ZombieFound: Cannot connect to process 2696, trying again in 3 seconds
Caught libdaemonjvm.server.LockError$ZombieFound: Cannot connect to process 2696, trying again in 3 seconds
Caught libdaemonjvm.server.LockError$ZombieFound: Cannot connect to process 2696, trying again in 3 seconds
Caught libdaemonjvm.server.LockError$ZombieFound: Cannot connect to process 2696, trying again in 3 seconds
Caught libdaemonjvm.server.LockError$ZombieFound: Cannot connect to process 2696, trying again in 3 seconds
Exception in thread "main" java.lang.Exception: libdaemonjvm.server.LockError$ZombieFound: Cannot connect to process 2696
        at bloop.Bloop$.loop$1(Bloop.scala:102)
        at bloop.Bloop$.main(Bloop.scala:114)
        at bloop.Bloop.main(Bloop.scala)
Caused by: libdaemonjvm.server.LockError$ZombieFound: Cannot connect to process 2696
        at libdaemonjvm.server.Lock$.ifProcessRunning$1(Lock.scala:59)
        at libdaemonjvm.server.Lock$.$anonfun$tryAcquire$6(Lock.scala:76)
        at libdaemonjvm.server.Lock$.$anonfun$tryAcquire$6$adapted(Lock.scala:75)
        at scala.Option.flatMap(Option.scala:271)
        at libdaemonjvm.server.Lock$.ifFiles$1(Lock.scala:75)
        at libdaemonjvm.server.Lock$.tryAcquire(Lock.scala:94)
        at bloop.Bloop$.loop$1(Bloop.scala:93)
        ... 2 more
Caused by: java.net.ConnectException: Connection refused: connect
        at java.base/sun.nio.ch.UnixDomainSockets.connect0(Native Method)
        at java.base/sun.nio.ch.UnixDomainSockets.connect(UnixDomainSockets.java:148)
        at java.base/sun.nio.ch.UnixDomainSockets.connect(UnixDomainSockets.java:144)
        at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:851)
        at libdaemonjvm.internal.Java16SocketHandler$.client(Java16SocketHandler.scala:22)
        at libdaemonjvm.internal.SocketHandler$.client(SocketHandler.scala:18)
        at libdaemonjvm.internal.SocketFile$.connect(SocketFile.scala:23)
        at libdaemonjvm.internal.SocketFile$.canConnect(SocketFile.scala:14)
        at libdaemonjvm.server.Lock$.ifProcessRunning$1(Lock.scala:57)
        ... 8 more

Expected behaviour

That the file is compiled and run.

@kavedaa kavedaa added the bug Something isn't working label May 9, 2024
@Gedochao Gedochao added the Bloop Issues tied with Bloop integration. label May 9, 2024
@Gedochao
Copy link
Contributor

Gedochao commented May 9, 2024

This is a known problem with Bloop. You likely have some inconsistent state in your Coursier cache.
To fix this, make sure to:

  • purge your local Coursier cache: https://get-coursier.io/docs/cache
  • scala-cli clean .
  • if this still doesn't help, try also purging C:\Users\Knut Arne Vedaa\AppData\Local\ScalaCli\data\bloop\daemon

If everything else fails, please try to provide us the outputs under increased verbosity with -v -v -v

scala-cli test.scala -v -v -v

If you're desparate to make your build work and the above steps did not help, you can also run Scala CLI with Bloop turned off by using --server=false. This should solve the problem for you, although building without Bloop is considerably slower.

scala-cli test.scala --server=false

@kavedaa
Copy link
Author

kavedaa commented May 9, 2024

I can confirm that purging the cache solved the issue. The other steps were not necessary.

@Gedochao
Copy link
Contributor

Gedochao commented May 9, 2024

I'll leave this open, as we don't seem to have any other ticket to track this particular issue.
The steps for the workaround are known, but optimally we should find a way to recover from this problem when it occurs.

@Gedochao Gedochao changed the title Compilation server fails to start Bloop libdaemonjvm.server.LockError$ZombieFound when Coursier cache is in an inconsistent state May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bloop Issues tied with Bloop integration. bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants