Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: Scala 2.12.0
    • Fix Version/s: None
    • Component/s: Repl / Interpreter
    • Labels:
      None
    • Environment:

      Welcome to Scala 2.12.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).

      Description

      Submitting a lambda as a callable and retrieving the future on the same line causes the REPL to hang.

      Welcome to Scala 2.12.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
      Type in expressions for evaluation. Or try :help.
       
      scala> import java.util.concurrent._
      import java.util.concurrent._
       
      scala> val exec = Executors.newCachedThreadPool
      exec: java.util.concurrent.ExecutorService = java.util.concurrent.ThreadPoolExecutor@7512870b[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
      

      OK, because not a lambda:

      scala> exec.submit(new Callable[String] { def call = "foo" }).get
      res0: String = foo
      

      OK, because retrieval separate from submission:

      scala> val f = exec.submit(() => "foo")
      f: java.util.concurrent.Future[String] = java.util.concurrent.FutureTask@2c81f298
       
      scala> f.get
      res1: String = foo
      

      Hangs:

      scala> exec.submit(() => "foo").get
      

      This was discovered in the real world by attempting scalaz.concurrent.Task("foo").run, which also hangs.

      The same snippets all complete successfully on Scala 2.11.8.

      Maybe related to SI-9076?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                retronym Jason Zaugg
                Reporter:
                rossabaker2 Ross A. Baker
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: