scala-cli
scala-cli copied to clipboard
Exception in thread "main" java.util.concurrent.TimeoutException: Future timed out after [30 seconds]
Version(s) VirtusLab/[email protected]
Describe the bug Encountered a TimeoutException while running a Scala application utilizing the Bloop build server. The error occurred during communication via the Build Server Protocol (BSP). Specifically, the stack trace indicates a timeout during a call to ensure the correct version of Bloop is running.
To Reproduce
- Install Scala-cli and set up a Scala project.
- Configure ScalaTest as the testing framework for the project.
- Execute ScalaTest tests using Scala-cli.
- Observe the TimeoutException error occurring intermittently during test execution.
Request: Seeking guidance and assistance in resolving the encountered bugs to ensure smooth execution of ScalaTest tests with Scala-cli. Any insights, suggestions, or workaround solutions would be greatly appreciated.
Can't reproduce the problem.
Given the following code:
//> using dep "org.scalatest::scalatest::3.2.18"
import org.scalatest._
import org.scalatest.flatspec._
import org.scalatest.matchers._
class Tests extends AnyFlatSpec with should.Matchers {
"A thing" should "thing" in {
assert(2 + 2 == 4)
}
}
the test runs smoothly from the command line:
scala-cli test smth.test.scala
# Compiling project (test, Scala 3.4.0, JVM (17))
# Compiled project (test, Scala 3.4.0, JVM (17))
# Tests:
# A thing
# - should thing
# Run completed in 71 milliseconds.
# Total number of tests run: 1
# Suites: completed 1, aborted 0
# Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
# All tests passed.
as well as in IDEA IntelliJ:
and in Metals
@kark7 Can you describe in more detail how do you replicate the timeout? what platform are you running on? A code snippet with the minimized issue would also be helpful.
@Gedochao , I am running on github runner with linux/amd64 platform.
Issue observed on: - name: scala-cli-setup-action uses: VirtusLab/[email protected]
Error: Exception in thread "main" java.util.concurrent.TimeoutException: Future timed out after [30 seconds] at scala.concurrent.impl.Promise$DefaultPromise.tryAwait0(Promise.scala:248) at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:261) at scala.concurrent.Await$.$anonfun$result$1(package.scala:201) at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:62) at scala.concurrent.Await$.result(package.scala:124) at bloop.rifle.internal.Operations$.timeout(Operations.scala:[53](https://github.com/glcp/harmony-spark-sdk-tests/actions/runs/8469340952/job/23204460363#step:5:54)1) at bloop.rifle.internal.Operations$.about(Operations.scala:499) at bloop.rifle.BloopRifle$.getCurrentBloopVersion(BloopRifle.scala:156) at bloop.rifle.BloopServer$.ensureBloopRunning(BloopServer.scala:111) at bloop.rifle.BloopServer$.bsp(BloopServer.scala:1[55](https://github.com/glcp/harmony-spark-sdk-tests/actions/runs/8469340952/job/23204460363#step:5:56)) at bloop.rifle.BloopServer$.buildServer(BloopServer.scala:185) at scala.build.compiler.BloopCompilerMaker.$anonfun$1(BloopCompilerMaker.scala:35) at scala.build.compiler.BloopCompiler.<init>(BloopCompiler.scala:15) at scala.build.compiler.BloopCompilerMaker.create$$anonfun$1(BloopCompilerMaker.scala:38) at scala.util.Try$.apply(Try.scala:210) at scala.build.compiler.BloopCompilerMaker.create(BloopCompilerMaker.scala:38) at scala.build.compiler.ScalaCompilerMaker.withCompiler(ScalaCompilerMaker.scala:29) at scala.build.compiler.ScalaCompilerMaker.withCompiler$(ScalaCompilerMaker.scala:7) at scala.build.compiler.BloopCompilerMaker.withCompiler(BloopCompilerMaker.scala:13) at scala.build.Build$.build(Build.scala:605) at scala.cli.commands.test.Test$.runCommand(Test.scala:180) at scala.cli.commands.test.Test$.runCommand(Test.scala:58) at scala.cli.commands.ScalaCommand.run(ScalaCommand.scala:368) at scala.cli.commands.ScalaCommand.run(ScalaCommand.scala:350) at caseapp.core.app.CaseApp.main(CaseApp.scala:1[57](https://github.com/glcp/harmony-spark-sdk-tests/actions/runs/8469340952/job/23204460363#step:5:58)) at scala.cli.commands.ScalaCommand.main(ScalaCommand.scala:335) at caseapp.core.app.CommandsEntryPoint.main(CommandsEntryPoint.scala:166) at scala.cli.ScalaCliCommands.main(ScalaCliCommands.scala:125) at scala.cli.ScalaCli$.main0(ScalaCli.scala:269) at scala.cli.ScalaCli$.main(ScalaCli.scala:108) at scala.cli.ScalaCli.main(ScalaCli.scala)
Hm... it's hard to guess what could be causing the timeout without a code snippet. @kark7 can you try to minimize what part of the test could be causing this?
note: this shouldn't influence the behaviour, but v1.1.3 is an old version of Scala CLI, you can use v1.2.0 instead (and v1.2.1 is being released today)
Closing as irreproducible, feel free to reopen along with reproduction steps.