scalacenter/bloop

Use multiple bloop servers on one machine

ckipp01 opened this issue · 1 comments

Originally report here: scalameta/metals#3301 (comment)

Describe the bug

Metals works well for the first user on ubuntu, but it cannot connect to the server for the other users on the same server.

Log

�[0m�[36m[T]�[0m bloop.data.Project$ProjectReadException: Failed to load project from /home/test_java6/SpinalTemplateSbt/.bloop/mylib-test.json
�[0m�[36m[T]�[0m bloop.data.Project$.fromBytesAndOrigin(Project.scala:193)
�[0m�[36m[T]�[0m bloop.engine.BuildLoader$.loadProject(BuildLoader.scala:256)
�[0m�[36m[T]�[0m bloop.engine.BuildLoader$.$anonfun$loadBuildIncrementally$3(BuildLoader.scala:60)
�[0m�[36m[T]�[0m monix.eval.internal.TaskRunLoop$.monix$eval$internal$TaskRunLoop$$loop$1(TaskRunLoop.scala:187)
�[0m�[36m[T]�[0m monix.eval.internal.TaskRunLoop$RestartCallback$1.onSuccess(TaskRunLoop.scala:119)
�[0m�[36m[T]�[0m monix.eval.Task$.$anonfun$forkedUnit$2(Task.scala:1463)
�[0m�[36m[T]�[0m java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
�[0m�[36m[T]�[0m java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
�[0m�[36m[T]�[0m java.lang.Thread.run(Thread.java:748)
�[0m�[36m[T]�[0m Caused by: java.nio.file.AccessDeniedException: /home/test_java6/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.11.12/scala-compiler-2.11.12.jar
�[0m�[36m[T]�[0m sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
�[0m�[36m[T]�[0m sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
�[0m�[36m[T]�[0m sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
�[0m�[36m[T]�[0m sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
�[0m�[36m[T]�[0m sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
�[0m�[36m[T]�[0m sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
�[0m�[36m[T]�[0m java.nio.file.Files.readAttributes(Files.java:1737)
�[0m�[36m[T]�[0m bloop.ScalaInstance.$anonfun$hashCode$1(ScalaInstance.scala:82)
�[0m�[36m[T]�[0m scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:286)
�[0m�[36m[T]�[0m scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
�[0m�[36m[T]�[0m scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
�[0m�[36m[T]�[0m scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:38)
�[0m�[36m[T]�[0m scala.collection.TraversableLike.map(TraversableLike.scala:286)
�[0m�[36m[T]�[0m scala.collection.TraversableLike.map$(TraversableLike.scala:279)
�[0m�[36m[T]�[0m scala.collection.AbstractTraversable.map(Traversable.scala:108)
�[0m�[36m[T]�[0m bloop.ScalaInstance.(ScalaInstance.scala:78)
�[0m�[36m[T]�[0m bloop.ScalaInstance$.newInstance$1(ScalaInstance.scala:152)
�[0m�[36m[T]�[0m bloop.ScalaInstance$.$anonfun$apply$7(ScalaInstance.scala:157)
�[0m�[36m[T]�[0m java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
�[0m�[36m[T]�[0m bloop.ScalaInstance$.apply(ScalaInstance.scala:157)
�[0m�[36m[T]�[0m bloop.data.Project$.$anonfun$fromConfig$1(Project.scala:210)
�[0m�[36m[T]�[0m scala.Option.flatMap(Option.scala:271)
�[0m�[36m[T]�[0m bloop.data.Project$.fromConfig(Project.scala:205)
�[0m�[36m[T]�[0m bloop.data.Project$.fromBytesAndOrigin(Project.scala:187)
�[0m�[36m[T]�[0m bloop.engine.BuildLoader$.loadProject(BuildLoader.scala:256)
�[0m�[36m[T]�[0m bloop.engine.BuildLoader$.$anonfun$loadBuildIncrementally$3(BuildLoader.scala:60)
�[0m�[36m[T]�[0m monix.eval.internal.TaskRunLoop$.monix$eval$internal$TaskRunLoop$$loop$1(TaskRunLoop.scala:187)
�[0m�[36m[T]�[0m monix.eval.internal.TaskRunLoop$RestartCallback$1.onSuccess(TaskRunLoop.scala:119)
�[0m�[36m[T]�[0m monix.eval.Task$.$anonfun$forkedUnit$2(Task.scala:1463)
�[0m�[36m[T]�[0m java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
�[0m�[36m[T]�[0m java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
�[0m�[36m[T]�[0m java.lang.Thread.run(Thread.java:748)
error: The launcher failed to establish a bsp connection, aborting...
�[0m2021.11.19 14:43:59 ERROR Failed to connect with build server, no functionality will work.
java.lang.RuntimeException: The server did not start, got FailedToOpenBspConnection
at bloop.launcher.LauncherMain.failPromise$1(Launcher.scala:95)
at bloop.launcher.LauncherMain.runLauncher(Launcher.scala:122)
at scala.meta.internal.metals.BloopServers$$anon$1.run(BloopServers.scala:159)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:829)

To Reproduce

User A opens a scala project on ubuntu server using vscode via remote ssh extension. Go to definition, auto complement work well.
User B opens another project. The metals displays "Failed to connect with build server, no functionality will work.
Expected behavior
Screenshots

Installation:

Operating system: Utuntu20
Editor: Visual Studio Code
Metals version: v1.10.15
Additional context

Search terms

Response from @tgodzik

Thanks for reporting! This is a current limitation of Bloop, but we are actually working on making it possible to use multiple Bloop servers on one machine.

bloop support BLOOP_PORT environemnt to start multiple servers with different port. How about let metals use this feature to start and communicate with bloop through an environement variable.