Hi,
since last Akka update (we're now using 2.1), I saw this exception popping in my logs from time to time :
java.lang.IllegalArgumentException: requirement failed: DeadLetter sender may not be null
at scala.Predef$.require(Predef.scala:233) ~[scala-library-2.10.0.jar:na]
at akka.actor.DeadLetter.<init>(ActorRef.scala:423) ~[akka-actor_2.10-2.1.0.jar:na]
at akka.actor.DeadLetterActorRef.$bang(ActorRef.scala:481) ~[akka-actor_2.10-2.1.0.jar:na]
at akka.actor.ActorRef.tell(ActorRef.scala:108) ~[akka-actor_2.10-2.1.0.jar:na]
Basically, when the single arg tell() has been deprecated I replace the few calls I had to the 2 args tell() using "null" as the sender. Is it wrong ? should I use a ref to some specific actor like deadletter ?
Thanks
N.
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user?hl=en.
Patrik Nordwall
Typesafe - The software stack for applications that scale
Twitter: @patriknw
Hey,
here is a java test case that reproduce the issue.
It happens when replying to the DeadLetterActorRef with a null sender. One of my service is ack-ing all request, where some requester are doing fire-and-forget requests (null sender).
Wish I figured it out before the 2.1 release :)
N.
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.testng.Assert;
import org.testng.annotations.Test;
import akka.actor.*;
public class NullSenderTest {
private volatile Throwable actorException;
@Test
public void canUseNullSender() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
class Ping extends UntypedActor {
public void onReceive(Object msg) throws Exception {
try {
// Sender is DeadLetter...
sender().tell("pong", null);
} catch (Exception e) {
actorException = e;
} finally {
latch.countDown();
}
}
}
ActorSystem system = ActorSystem.create();
ActorRef ping = system.actorOf(new Props(new UntypedActorFactory() {
public Actor create() throws Exception {
return new Ping();
}
}));
ping.tell("ping", null);
latch.await(100, TimeUnit.MILLISECONDS);
if (actorException != null) {
Assert.fail(actorException.getMessage(), actorException);
}
}
}
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user?hl=en.