scalacenter / bloop

Bloop is a build server and CLI tool to compile, test and run Scala fast from any editor or build tool.
https://scalacenter.github.io/bloop/
Apache License 2.0
907 stars 202 forks source link

Bloop compiler Hangs on Test Build #1748

Open TRReeve opened 2 years ago

TRReeve commented 2 years ago

Hi all.

I have run into an issue with the compilation in bloop which was surfacing for me in Metals where the compiler was hanging indefinitely on building "root-test". This also causes a large amount of CPU usage on my mac in the background. I'm not entirely sure if this is to do with the fact its "root-test" or if there's something in the code causing it that is revealed when it's compiled in the test modules.

Problem Bloop seems to run a build as usual on "root". I can also compile using SBT perfectly fine. When I am working on my test code however the build hangs indefinitely. The problem reproduces across most recent versions of Metals and on Scala 3.1.2 + 3.2.0 and adding more memory to bloop/metals et al doesn't yield any changes.

Environment: VSCode Java 17 Graal Mac OS 12.4

Expected Behaviour:

The test compiles the same as the main code base/SBT.

Reproduction attempt bloop_compile_issue.zip

To reproduce hanging issue bloop compile --verbose root-test

Doesn't hang bloop compile --verbose root

Thread Dump in particuar global-executor-23 looks a bit "loopy" but I don't know enough to say if it's related for sure. thread_dump.zip

tgodzik commented 2 years ago

Thanks for reporting! I minimized it further and it seems an exception is thrown:

https://github.com/lampepfl/dotty/issues/15567

Bloop was hanging instead of throwing it further unfortunately.

tgodzik commented 2 years ago

We need to make sure that Bloop throws an exception properly here.

tgodzik commented 2 years ago

Just checked and the infinite loop itself is fixed in 3.2.1-RC1-bin-20220704-dc5a9a4-NIGHTLY