-
-
Save teamon/1177321 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name := "akka netty unfiltered remote actors fail" | |
scalaVersion := "2.9.0-1" | |
resolvers += "Akka Repository" at "http://akka.io/repository" | |
libraryDependencies += "se.scalablesolutions.akka" % "akka-actor" % "1.1.3" | |
libraryDependencies += "se.scalablesolutions.akka" % "akka-remote" % "1.1.3" | |
libraryDependencies += "net.databinder" %% "unfiltered-netty" % "0.4.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to run | |
In two separate terminals run Web and Service main classes, then make request to http://localhost:8080 | |
Accessing http://localhost:8080/local - works | |
Accessing http://localhost:8080/remote - java.lang.IllegalStateException: await*() in I/O thread causes a dead lock or sudden performance drop. Use addListener() instead or call await*() from a different thread. | |
When invoking form scala REPL (sbt console): | |
scala> val ref = akka.actor.Actor.remote.actorFor("service", "localhost", 9999) | |
scala> ref ! "msg" | |
everything works fine | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ERROR] [8/29/11 12:40 AM] [New I/O server worker #1-1] [Switch] await*() in I/O thread causes a dead lock or sudden performance drop. Use addListener() instead or call await*() from a different thread. | |
java.lang.IllegalStateException: await*() in I/O thread causes a dead lock or sudden performance drop. Use addListener() instead or call await*() from a different thread. | |
at org.jboss.netty.channel.DefaultChannelFuture.checkDeadLock(DefaultChannelFuture.java:296) | |
at org.jboss.netty.channel.DefaultChannelFuture.awaitUninterruptibly(DefaultChannelFuture.java:208) | |
at akka.remote.netty.ActiveRemoteClient$$anonfun$connect$1.apply$mcV$sp(NettyRemoteSupport.scala:381) | |
at akka.util.Switch.liftedTree1$1(LockUtil.scala:126) | |
at akka.util.Switch.transcend(LockUtil.scala:125) | |
at akka.util.Switch.switchOn(LockUtil.scala:138) | |
at akka.remote.netty.ActiveRemoteClient.connect(NettyRemoteSupport.scala:370) | |
at akka.remote.netty.NettyRemoteClientModule$class.withClientFor(NettyRemoteSupport.scala:109) | |
at akka.remote.netty.NettyRemoteSupport.withClientFor(NettyRemoteSupport.scala:589) | |
at akka.remote.netty.NettyRemoteClientModule$class.send(NettyRemoteSupport.scala:90) | |
at akka.remote.netty.NettyRemoteSupport.send(NettyRemoteSupport.scala:589) | |
at akka.actor.RemoteActorRef.postMessageToMailbox(ActorRef.scala:1158) | |
at akka.actor.ScalaActorRef$class.$bang(ActorRef.scala:1311) | |
at akka.actor.RemoteActorRef.$bang(ActorRef.scala:1135) | |
at test.MainPlan$$anonfun$intent$1.apply(Test.scala:14) | |
at test.MainPlan$$anonfun$intent$1.apply(Test.scala:11) | |
at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45) | |
at unfiltered.netty.cycle.Plan$class.messageReceived(plans.scala:27) | |
at test.MainPlan.messageReceived(Test.scala:10) | |
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302) | |
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndfireMessageReceived(ReplayingDecoder.java:522) | |
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:506) | |
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:443) | |
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274) | |
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261) | |
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349) | |
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280) | |
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) | |
at java.lang.Thread.run(Thread.java:680) | |
Aug 29, 2011 12:40:55 AM org.jboss.netty.channel.SimpleChannelUpstreamHandler | |
WARNING: EXCEPTION, please implement unfiltered.netty.NotFoundHandler.exceptionCaught() for proper handling. | |
java.lang.IllegalStateException: await*() in I/O thread causes a dead lock or sudden performance drop. Use addListener() instead or call await*() from a different thread. | |
at org.jboss.netty.channel.DefaultChannelFuture.checkDeadLock(DefaultChannelFuture.java:296) | |
at org.jboss.netty.channel.DefaultChannelFuture.awaitUninterruptibly(DefaultChannelFuture.java:208) | |
at akka.remote.netty.ActiveRemoteClient$$anonfun$connect$1.apply$mcV$sp(NettyRemoteSupport.scala:381) | |
at akka.util.Switch.liftedTree1$1(LockUtil.scala:126) | |
at akka.util.Switch.transcend(LockUtil.scala:125) | |
at akka.util.Switch.switchOn(LockUtil.scala:138) | |
at akka.remote.netty.ActiveRemoteClient.connect(NettyRemoteSupport.scala:370) | |
at akka.remote.netty.NettyRemoteClientModule$class.withClientFor(NettyRemoteSupport.scala:109) | |
at akka.remote.netty.NettyRemoteSupport.withClientFor(NettyRemoteSupport.scala:589) | |
at akka.remote.netty.NettyRemoteClientModule$class.send(NettyRemoteSupport.scala:90) | |
at akka.remote.netty.NettyRemoteSupport.send(NettyRemoteSupport.scala:589) | |
at akka.actor.RemoteActorRef.postMessageToMailbox(ActorRef.scala:1158) | |
at akka.actor.ScalaActorRef$class.$bang(ActorRef.scala:1311) | |
at akka.actor.RemoteActorRef.$bang(ActorRef.scala:1135) | |
at test.MainPlan$$anonfun$intent$1.apply(Test.scala:14) | |
at test.MainPlan$$anonfun$intent$1.apply(Test.scala:11) | |
at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45) | |
at unfiltered.netty.cycle.Plan$class.messageReceived(plans.scala:27) | |
at test.MainPlan.messageReceived(Test.scala:10) | |
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302) | |
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndfireMessageReceived(ReplayingDecoder.java:522) | |
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:506) | |
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:443) | |
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274) | |
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261) | |
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349) | |
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280) | |
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) | |
at java.lang.Thread.run(Thread.java:680) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
import unfiltered.request._ | |
import unfiltered.response._ | |
import unfiltered.netty._ | |
import unfiltered.netty.cycle.Plan | |
import akka.actor._ | |
class MainPlan(localRef: ActorRef) extends Plan { | |
def intent = { | |
case GET(Path("/remote")) => // [ERROR] [8/29/11 12:23 AM] [New I/O server worker #2-1] [Switch] await*() in I/O thread causes a dead lock or sudden performance drop. Use addListener() instead or call await*() from a different thread. | |
val ref = Actor.remote.actorFor("service", "localhost", 9999) | |
ref ! "foo" | |
Ok | |
case GET(Path("/local")) => | |
localRef ! "foo" | |
Ok | |
} | |
} | |
class TestActor extends Actor { | |
def receive = { | |
case msg => println("got " + msg) | |
} | |
} | |
object Web { | |
def main(args: Array[String]): Unit = { | |
val actor = Actor.actorOf[TestActor].start | |
import org.jboss.netty.handler.execution._ | |
val executaionHandler = new ExecutionHandler( | |
new OrderedMemoryAwareThreadPoolExecutor(16, 1048576, 1048576) | |
) | |
Http(8080).handler(executaionHandler).handler(new MainPlan(actor)).run | |
} | |
} | |
object Service { | |
def main(args: Array[String]): Unit = { | |
val actor = Actor.actorOf[TestActor].start | |
Actor.remote.start("localhost", 9999) | |
Actor.remote.register("service", actor) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
import unfiltered.request._ | |
import unfiltered.response._ | |
import unfiltered.netty._ | |
import unfiltered.netty.cycle.Plan | |
import akka.actor._ | |
class MainPlan(localRef: ActorRef) extends Plan { | |
def intent = { | |
case GET(Path("/remote")) => // [ERROR] [8/29/11 12:23 AM] [New I/O server worker #2-1] [Switch] await*() in I/O thread causes a dead lock or sudden performance drop. Use addListener() instead or call await*() from a different thread. | |
val ref = Actor.remote.actorFor("service", "localhost", 9999) | |
ref ! "foo" | |
Ok | |
case GET(Path("/local")) => | |
localRef ! "foo" | |
Ok | |
} | |
} | |
class TestActor extends Actor { | |
def receive = { | |
case msg => println("got " + msg) | |
} | |
} | |
object Web { | |
def main(args: Array[String]): Unit = { | |
val actor = Actor.actorOf[TestActor].start | |
Http(8080).handler(new MainPlan(actor)).run | |
} | |
} | |
object Service { | |
def main(args: Array[String]): Unit = { | |
val actor = Actor.actorOf[TestActor].start | |
Actor.remote.start("localhost", 9999) | |
Actor.remote.register("service", actor) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment