Scala Programming Language
  1. Scala Programming Language
  2. SI-4759

Actors: java.lang.RuntimeException: unhandled timeout exception when using '!?'

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.0
    • Fix Version/s: Scala 2.9.1, Scala 2.10.0
    • Component/s: Misc Library
    • Labels:
      None
    • Environment:

      Windows 7 Professional (64 bit)

      java version "1.6.0_24"
      Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
      Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

      Description

      The issue occurs when an actor sends a message using !? in certain scenarios. One example is given in the code.
      An unhandled timeput exception is thrown in the following code. See screenshot of the run.

      package test
      import scala.actors.Actor
      object Run { 
        def main(args: Array[String]) = { while (true) {A1 ! 1; Thread.sleep(1000) } }
      }
      object A2 extends Actor {
        this.start
        def act = loop { react { case _ => } }
      }
      object A1 extends Actor {
        this.start
        def act = loop { react { case any => A2 !? (1000, any) } } 
      }
      

      Save above code into a file test.scala and use following to run: Assume Scala 2.9.0.1 is installed in C:\scala-2.9.0.1

      scalac test.scala
      java -cp .;c:\scala-2.9.0.1\lib\scala-library.jar test.Run
      

      Exception thrown is:

      test.A1$@785f8172: caught java.lang.RuntimeException: unhandled timeout
      java.lang.RuntimeException: unhandled timeout
              at scala.sys.package$.error(package.scala:27)
              at scala.actors.Actor$class.receiveWithin(Actor.scala:606)
              at test.A1$.receiveWithin(test.scala:10)
              at scala.actors.Channel.receiveWithin(Channel.scala:71)
              at scala.actors.ActorCanReply$class.$bang$qmark(ActorCanReply.scala:32)
              at test.A2$.$bang$qmark(test.scala:6)
              at test.A1$$anonfun$act$2$$anonfun$apply$2.apply(test.scala:12)
              at test.A1$$anonfun$act$2$$anonfun$apply$2.apply(test.scala:12)
              at scala.actors.ReactorTask.run(ReactorTask.scala:31)
              at scala.actors.ReactorTask.compute(ReactorTask.scala:63)
              at scala.concurrent.forkjoin.RecursiveAction.exec(RecursiveAction.java:147)
              at scala.concurrent.forkjoin.ForkJoinTask.quietlyExec(ForkJoinTask.java:422)
              at scala.concurrent.forkjoin.ForkJoinWorkerThread.mainLoop(ForkJoinWorkerThread.java:340)
              at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:325)

        Activity

        Hide
        Amitabh added a comment -

        Reduced size of screenshot

        Show
        Amitabh added a comment - Reduced size of screenshot
        Hide
        Philipp Haller added a comment -

        Fixed in r25252.

        Show
        Philipp Haller added a comment - Fixed in r25252.

          People

          • Assignee:
            Philipp Haller
            Reporter:
            Amitabh
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development