scalacenter/bloop

Failed to compile project because file in `bloop-bsp-clients-classes` already exists

kpodsiad opened this issue · 1 comments

Hit this issue with metals when navigation just stopped working silently. Bloop cli also was failing to compile project without any reason, only after I tried bloop compile --verbose --project I found what's the issue. Then I discovered plenty of directoties under each project's bloop-internal-classes, seems like bloop is not handling lifecycle of them.
Some time ago I saw a issue when someone was complaining about how much bloop is writing to the hard drive and I have to second that opinion.

Below I paste what I got from verbose logging:

[D] Increasing counter for PATH/.bloop/project_name/bloop-internal-classes/classes-Metals-3XCrIIkjTx6g-RwgkDVONA==-_miyDw_wTvK_oplHQK0jXA== to 26
[T] java.nio.file.FileAlreadyExistsException: PATH/.bloop/project_name/bloop-bsp-clients-classes/classes-Metals-3XCrIIkjTx6g-RwgkDVONA==/package/className.class
[T]     java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:94)
[T]     java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
[T]     java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
[T]     java.base/sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:246)
[T]     java.base/sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:603)
[T]     java.base/sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:257)
[T]     java.base/java.nio.file.Files.copy(Files.java:1305)
[T]     bloop.io.ParallelOps$.copy$1(ParallelOps.scala:161)
[T]     bloop.io.ParallelOps$.$anonfun$copyDirectories$8(ParallelOps.scala:180)
[T]     scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[T]     monix.eval.internal.TaskRunLoop$.startFuture(TaskRunLoop.scala:494)
[T]     monix.eval.Task.runToFutureOpt(Task.scala:586)
[T]     monix.eval.internal.TaskDeprecated$Extensions.runSyncMaybeOptPrv(TaskDeprecated.scala:128)
[T]     monix.eval.internal.TaskDeprecated$Extensions.$anonfun$coeval$1(TaskDeprecated.scala:303)
[T]     monix.eval.Coeval$Always.apply(Coeval.scala:1451)
[T]     monix.eval.Coeval.value(Coeval.scala:258)
[T]     bloop.io.ParallelOps$.$anonfun$copyDirectories$7(ParallelOps.scala:220)
[T]     monix.reactive.internal.consumers.ForeachAsyncConsumer$$anon$1.onNext(ForeachAsyncConsumer.scala:44)
[T]     monix.reactive.internal.consumers.LoadBalanceConsumer$$anon$1.$anonfun$signalNext$1(LoadBalanceConsumer.scala:218)
[T]     monix.execution.internal.InterceptRunnable.run(InterceptRunnable.scala:27)
[T]     java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[T]     java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[T]     java.base/java.lang.Thread.run(Thread.java:833)
[E] Unexpected error when compiling project_name: 'PATH/.bloop/project_name/bloop-bsp-clients-classes/classes-Metals-3XCrIIkjTx6g-RwgkDVONA==/package/className.class'
[T] java.nio.file.FileAlreadyExistsException: PATH/.bloop/project_name/bloop-bsp-clients-classes/classes-Metals-3XCrIIkjTx6g-RwgkDVONA==/package/className.class
[T]     java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:94)
[T]     java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
[T]     java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
[T]     java.base/sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:246)
[T]     java.base/sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:603)
[T]     java.base/sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:257)
[T]     java.base/java.nio.file.Files.copy(Files.java:1305)
[T]     bloop.io.ParallelOps$.copy$1(ParallelOps.scala:161)
[T]     bloop.io.ParallelOps$.$anonfun$copyDirectories$8(ParallelOps.scala:180)
[T]     scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[T]     monix.eval.internal.TaskRunLoop$.startFuture(TaskRunLoop.scala:494)
[T]     monix.eval.Task.runToFutureOpt(Task.scala:586)
[T]     monix.eval.internal.TaskDeprecated$Extensions.runSyncMaybeOptPrv(TaskDeprecated.scala:128)
[T]     monix.eval.internal.TaskDeprecated$Extensions.$anonfun$coeval$1(TaskDeprecated.scala:303)
[T]     monix.eval.Coeval$Always.apply(Coeval.scala:1451)
[T]     monix.eval.Coeval.value(Coeval.scala:258)
[T]     bloop.io.ParallelOps$.$anonfun$copyDirectories$7(ParallelOps.scala:220)
[T]     monix.reactive.internal.consumers.ForeachAsyncConsumer$$anon$1.onNext(ForeachAsyncConsumer.scala:44)
[T]     monix.reactive.internal.consumers.LoadBalanceConsumer$$anon$1.$anonfun$signalNext$1(LoadBalanceConsumer.scala:218)
[T]     monix.execution.internal.InterceptRunnable.run(InterceptRunnable.scala:27)
[T]     java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[T]     java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[T]     java.base/java.lang.Thread.run(Thread.java:833)
[E] Failed to compile 'project_name'
[D] Finished copying classes from PATH/.bloop/project_name_2/bloop-internal-classes/classes-Metals-7A_ERWYaTdq8TLiI1RVipQ==-geiXUegkSBC0Zphhqlz7WQ== to PATH/.bloop/project_name_2/bloop-bsp-clients-classes/classes-bloop-cli-6HcB8NZ2R7GY_IjXSqO6KA==

I haven't seen this error in a while, my workaround seems to have helped unless anyone sees this happening still?