Hello everyone,
I wanted to do some testing with akka but I ran into a problem.
I register a remote server actor. This remote server actor sends a
message with an network actor to the client. The network actor was
created on the server and started there. The client then sends a
message to the network actor but I get the following exception when
the serialized network actor is send from the server:
test remote server:
[GENERIC] [12/30/11 11:31 AM]
[RemoteServerStarted(akka.remote.netty.NettyRemoteSupport@63cd66ea)]
[GENERIC] [12/30/11 11:32 AM]
[RemoteServerClientConnected(akka.remote.netty.NettyRemoteSupport@63cd66ea,Some(/
10.10.10.139:50960))]
SERVER: GOT MESSAGE test.TestServer$SomeMessage@45e67e6aon
test.TestServer@1f758500
[GENERIC] [12/30/11 11:32 AM]
[RemoteClientError(java.net.ConnectException: Connection
refused,akka.remote.netty.NettyRemoteSupport@63cd66ea,/
10.10.10.139:2552)]
[GENERIC] [12/30/11 11:32 AM]
[RemoteClientError(java.net.ConnectException: Connection
refused,akka.remote.netty.NettyRemoteSupport@63cd66ea,/
10.10.10.139:2552)]
[GENERIC] [12/30/11 11:32 AM]
[RemoteClientError(java.nio.channels.ClosedChannelException,akka.remote.netty.NettyRemoteSupport@63cd66ea,/
10.10.10.139:2552)]
SERVER: GOT MESSAGE test.TestServer$RequestMessage@68302e67on
test.TestServer@1f758500
[GENERIC] [12/30/11 11:32 AM] [RemoteClientWriteFailed(uuid {
high: 9536806518902559201
low: 12687484738590420383
}
actorInfo {
uuid {
high: 9535775726751519201
low: 12687484738590420383
}
target: "test.TestClient"
timeout: 5000
actorType: SCALA_ACTOR
id: "uuid:84130c20-32d1-11e1-ab7d-002608df2d9f"
}
oneWay: true
message {
serializationScheme: JAVA
message: "\254\355\000\005sr\000\035test.TestServer$ReturnMessage
\303\334\370\264\230\027O\002\000\000xp"
}
sender {
classOrServiceName: "uuid:8148efa0-32d1-11e1-b013-002608df2d9f"
actorClassname: "test.TestServer"
homeAddress {
hostname: "10.10.10.139"
port: 12345
}
timeout: 5000
}
,java.nio.channels.ClosedChannelException,akka.remote.netty.NettyRemoteSupport@63cd66ea,/
10.10.10.139:2552)]
[GENERIC] [12/30/11 11:32 AM]
[RemoteClientError(java.nio.channels.ClosedChannelException,akka.remote.netty.NettyRemoteSupport@63cd66ea,/
10.10.10.139:2552)]
[ERROR] [12/30/11 11:32 AM] [akka:event-driven:dispatcher:global-3]
[LocalActorRef] null
java.nio.channels.ClosedChannelException
at
org.jboss.netty.channel.socket.nio.NioWorker.cleanUpWriteBuffer(NioWorker.java:
643)
at
org.jboss.netty.channel.socket.nio.NioWorker.writeFromUserCode(NioWorker.java:
370)
at
org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:
117)
at org.jboss.netty.channel.Channels.write(Channels.java:632)
at
org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:
70)
at org.jboss.netty.channel.Channels.write(Channels.java:632)
at
org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:
70)
at org.jboss.netty.channel.Channels.write(Channels.java:611)
at org.jboss.netty.channel.Channels.write(Channels.java:578)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:
251)
at akka.remote.netty.RemoteClient.send(NettyRemoteSupport.scala:292)
at akka.remote.netty.RemoteClient.send(NettyRemoteSupport.scala:252)
at akka.remote.netty.NettyRemoteClientModule$$anonfun$send
$1.apply(NettyRemoteSupport.scala:109)
at akka.remote.netty.NettyRemoteClientModule$$anonfun$send
$1.apply(NettyRemoteSupport.scala:109)
at akka.remote.netty.NettyRemoteClientModule
$class.withClientFor(NettyRemoteSupport.scala:134)
at
akka.remote.netty.NettyRemoteSupport.withClientFor(NettyRemoteSupport.scala:
647)
at akka.remote.netty.NettyRemoteClientModule
$class.send(NettyRemoteSupport.scala:109)
at akka.remote.netty.NettyRemoteSupport.send(NettyRemoteSupport.scala:
647)
at akka.actor.RemoteActorRef.postMessageToMailbox(ActorRef.scala:
1255)
at akka.actor.ScalaActorRef$class.$bang(ActorRef.scala:1419)
at akka.actor.RemoteActorRef.$bang(ActorRef.scala:1224)
at akka.actor.ActorRef$class.reply(ActorRef.scala:398)
at akka.actor.LocalActorRef.reply(ActorRef.scala:605)
at test.TestServer.onReceive(Unknown Source)
at akka.actor.UntypedActor$$anonfun$receive
$1.apply(UntypedActor.scala:125)
at akka.actor.UntypedActor$$anonfun$receive
$1.apply(UntypedActor.scala:124)
at akka.actor.Actor$class.apply(Actor.scala:545)
at akka.actor.UntypedActor.apply(UntypedActor.scala:57)
at akka.actor.LocalActorRef.invoke(ActorRef.scala:910)
at akka.dispatch.MessageInvocation.invoke(MessageHandling.scala:25)
at akka.dispatch.ExecutableMailbox
$class.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:223)
at akka.dispatch.ExecutorBasedEventDrivenDispatcher$$anon
$4.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:123)
at akka.dispatch.ExecutableMailbox
$class.run(ExecutorBasedEventDrivenDispatcher.scala:195)
at akka.dispatch.ExecutorBasedEventDrivenDispatcher$$anon
$4.run(ExecutorBasedEventDrivenDispatcher.scala:123)
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)
at akka.dispatch.MonitorableThread.run(ThreadPoolBuilder.scala:192)
I don't know how to solve this problem. The serialization of the actor
is done flowing the instruction at
http://akka.io/docs/akka/1.3-RC4/scala/serialization.html#serialization-of-a-remoteactorref
.
Currently I use the default akka configuration.
The source code and instructions to reproduce the error you will find
in the google code project
https://code.google.com/p/akka-remote-error-example/
The project was tested with akka version 1.3 rc4 and 1.2. In the
project you have the instructions for 3 different test cases. The
first one don't uses any remote stuff but with this test case you can
see that the actors are working properly. The second test case uses
the remote stuff but everything is in the same vm. The third test case
you have to run in tow different terminals and here the error occurs.
Thanks for any help
Max