Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
scabug opened this issue Jul 2, 2011 · 3 comments
Closed
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jul 2, 2011

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:
{noformat}
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){noformat}

@scabug
Copy link
Author

scabug commented Jul 2, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4759?orig=1
Reporter: Amitabh (amitabh)
Affected Versions: 2.9.0
Other Milestones: 2.10.0
Attachments:

@scabug
Copy link
Author

scabug commented Jul 2, 2011

Amitabh (amitabh) said:
Reduced size of screenshot

@scabug
Copy link
Author

scabug commented Jul 7, 2011

@phaller said:
Fixed in r25252.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants