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

Scala remote actor server blocked on writing message to client actor #4942

Closed
scabug opened this issue Aug 25, 2011 · 9 comments
Closed

Scala remote actor server blocked on writing message to client actor #4942

scabug opened this issue Aug 25, 2011 · 9 comments
Assignees

Comments

@scabug
Copy link

scabug commented Aug 25, 2011

The server is blocked on writing data to a client actor: the server thread stack looks like this:

Name: ForkJoinPool-1-worker-0
State: RUNNABLE
Total blocked: 85  Total waited: 288

Stack trace: 
java.net.SocketOutputStream.socketWrite0(Native Method)
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
java.io.DataOutputStream.write(DataOutputStream.java:90)
   - locked java.io.DataOutputStream@920c22
java.io.FilterOutputStream.write(FilterOutputStream.java:80)
scala.actors.remote.TcpServiceWorker.transmit(TcpService.scala:237)
   - locked scala.actors.remote.TcpServiceWorker@5a9ff6
scala.actors.remote.TcpService.send(TcpService.scala:122)
   - locked scala.actors.remote.TcpService@d45d85
scala.actors.remote.NetKernel.sendToNode(NetKernel.scala:33)
scala.actors.remote.NetKernel.namedSend(NetKernel.scala:39)
scala.actors.remote.NetKernel.forward(NetKernel.scala:71)
scala.actors.remote.DelegateActor$$anonfun$act$1$$anonfun$apply$1.apply(Proxy.scala:180)
scala.actors.remote.DelegateActor$$anonfun$act$1$$anonfun$apply$1.apply(Proxy.scala:121)
scala.actors.ReactorTask.run(ReactorTask.scala:31)
scala.actors.Reactor$class.resumeReceiver(Reactor.scala:129)
scala.actors.remote.DelegateActor.scala$actors$ReplyReactor$$super$resumeReceiver(Proxy.scala:115)
scala.actors.ReplyReactor$class.resumeReceiver(ReplyReactor.scala:68)
scala.actors.remote.DelegateActor.resumeReceiver(Proxy.scala:115)
scala.actors.Actor$class.searchMailbox(Actor.scala:500)
scala.actors.remote.DelegateActor.searchMailbox(Proxy.scala:115)
scala.actors.Reactor$$anonfun$startSearch$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(Reactor.scala:117)
scala.actors.Reactor$$anonfun$startSearch$1$$anonfun$apply$mcV$sp$1.apply(Reactor.scala:114)
scala.actors.Reactor$$anonfun$startSearch$1$$anonfun$apply$mcV$sp$1.apply(Reactor.scala:114)
scala.actors.ReactorTask.run(ReactorTask.scala:33)
scala.concurrent.forkjoin.ForkJoinPool$AdaptedRunnable.exec(ForkJoinPool.java:611)
scala.concurrent.forkjoin.ForkJoinTask.quietlyExec(ForkJoinTask.java:422)
scala.concurrent.forkjoin.ForkJoinWorkerThread.mainLoop(ForkJoinWorkerThread.java:340)
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:325)

The server will now be inaccessible for communication purposes and has to be restarted. This happens regularly and is crippling.

@scabug
Copy link
Author

scabug commented Aug 25, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4942?orig=1
Reporter: @oxbowlakes
Affected Versions: 2.9.0-1

@scabug
Copy link
Author

scabug commented May 4, 2012

@magarciaEPFL said:

@oxbowlakes, could you please confirm whether the problem is still in trunk?

@scabug
Copy link
Author

scabug commented May 4, 2012

@oxbowlakes said:
I can't comment I'm afraid Miguel. The problem is a rare one which occurs in a production application roughly once every few weeks to a month. I simply can't (for obvious reasons) replace the production application with one built against trunk.

If you think that this might be fixed but you aren't sure, I will be upgrading to 2.10 shortly after it comes out, so we should get a handle reasonably quickly on whether the issue still persists.

TBH, it seems likely that I need to set some kind of system-wide timeout on connect/read attempts via a JVM property - possibly like those defined here (http://webcache.googleusercontent.com/search?q=cache:http://download.oracle.com/javase/1.4.2/docs/guide/net/properties.html)

@scabug
Copy link
Author

scabug commented May 4, 2012

@vjovanov said:
This issue has not been fixed in trunk since Actors are being deprecated in the standard library and will be replaced with Akka Actors. Also actors will be removed from the scala-library.jar into scala-actors.jar. The actors package will continue to live in a separate repository but will not be maintained by the Scala Team.

We were not planning to fix bugs in actors any more but if it crashes your production environment we can find a solution. I see following options:

  • migrate your system to Akka actors. We are providing the Actor Migration Kit which will enable smooth migration. I would recommend this step since Akka has superior performance and is rapidly developed and maintained
  • fix the bug in trunk and submit a pull request to the master branch. In the request you can specify vjovanov or phaller as the reviewer.

@scabug
Copy link
Author

scabug commented May 4, 2012

@magarciaEPFL said:
@vjovanov, that means we will leave a note about the maintenance policy (see [#comment-57282]) for Scala Actors bugs, before closing them with WONTFIX (not a criticism, just looking for consensus on how to move forward).

@scabug
Copy link
Author

scabug commented May 18, 2012

@oxbowlakes said:
My playing around with system properties has been unsuccessful and the issue persists. Could you at least add a scala-actors system property and modify the code in TcpService.scala (line 179) to call setSoTimeout if the property is set. The property could be called scala.actors.tcpSocket.soTimeout. I'd recommend adding options for the others as well

@scabug
Copy link
Author

scabug commented May 18, 2012

@oxbowlakes said:
By the way - is there a version of the actor migration kit available? I really question how easy this will be with mature, complex systems. The akka failure model is quite different from the scala one. As a project, it's difficult to justify. I'd rather fork and fix the issues with scala actors

@scabug
Copy link
Author

scabug commented May 18, 2012

@vjovanov said:
Yes, there is. It will been merged into trunk soon (scala/scala#575). The kit is contained in the scala-actors-migration.jar however the guide document is not complete yet. It will be published once Akka merges code corresponding to the Migration Kit into their repository.

To get the flavor of migration before the official guide is released you can take a look at the test cases with "test/files/jvm/actmig-" prefix. They show some of the most common patterns with actors. If you have additional questions you can contact me directly. Also any input on the migration kit is highly appreciated.

@scabug scabug closed this as completed Jul 17, 2015
@scabug
Copy link
Author

scabug commented Jul 17, 2015

@SethTisue said:
Scala actors are deprecated and unmaintained

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

No branches or pull requests

2 participants