[Akka 2.1.2] How to detect that mailbox is full when using "tell"?

777 views
Skip to first unread message

Diego Varese

unread,
Apr 23, 2013, 10:49:09 AM4/23/13
to akka...@googlegroups.com
 Before 2.1, trying to send a message to an actor with a full mailbox would throw a MessageQueueAppendFailedException which allowed the sender to handle the error (eg: return a 429 status code). However, after 2.1 the send succeeds and the message ends up in the Dead Letter office. Is there a synchronous (or at least time-limited) way of knowing if the message append will fail? 

I realize this change was probably added to make transparent appending to local or remote actors, but it seems like a very large change for the worse, not being able to know if the message will or will not be handled by the actor eventually. Particularly in our case, we had some logic to return 429 status codes when our actor's mailbox was full as a way of throttling requests, and I don't see how this can be achieved now.

Thanks

Diego

Roland Kuhn

unread,
Apr 24, 2013, 11:10:17 AM4/24/13
to akka...@googlegroups.com
Hi Diego,

you are right, we removed this behavior since it is inconsistent between local and remote and also across different mailbox implementations. The other reason is demonstrated by your quote “… or will not be handled by the actor eventually”: enqueuing successfully does by no means entail any guarantee of processing. If your error handling relied exclusively on these exceptions (which I’m sure was not the case, I’d just like to be explicit here) then your application would break in case the actor fails or terminates.

The solution to such back-pressure problems is to make the queueing explicit instead of hiding it in the actor’s mailbox. Then the queue is handled by an actor in front of the actual business actor and this one can then send back negative acknowledgements in case it drop messages due to overflow.

Regards,

Roland

--
>>>>>>>>>> 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 unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Empowering professional developers to build amazing apps.
twitter: @rolandkuhn

Erik Nelson

unread,
May 29, 2013, 6:41:30 PM5/29/13
to akka...@googlegroups.com
This is a pretty big change, and totally invalidates the advice I was given that I could do what I needed with 2.0 via custom mailboxes. Hurray, more reimplementation!

It is also not reflected in the current documentation or the migration guide - the migration guide does not mention the change, and http://doc.akka.io/docs/akka/2.1.4/scala/actors.html still has the now non-existant exception.

Given how much of a logic change this is, documentation of it would seem like a high priority.

 erik

Jonas Bonér

unread,
May 30, 2013, 4:01:25 AM5/30/13
to akka...@googlegroups.com
Sorry to hear that you have relied on this and have to do some major
reimplementation.
I agree that it should be well documented.
--
Jonas Bonér
Phone: +46 733 777 123
Home: jonasboner.com
Twitter: @jboner

Roland Kuhn

unread,
May 30, 2013, 4:41:23 AM5/30/13
to akka...@googlegroups.com
Hi Erik,

30 maj 2013 kl. 00:41 skrev Erik Nelson:

This is a pretty big change, and totally invalidates the advice I was given that I could do what I needed with 2.0 via custom mailboxes. Hurray, more reimplementation!

I’m sorry to hear that; I tried finding your use-case in the archives but did not succeed, what exactly is it that you are modeling using these exceptions?

It is also not reflected in the current documentation or the migration guide - the migration guide does not mention the change, and http://doc.akka.io/docs/akka/2.1.4/scala/actors.html still has the now non-existant exception.

Okay, will fix. Thanks for pointing this out.

Regards,

Roland
See you at Scala Days 2013 in NYC!
June 10th - June 12th
www.scaladays.org

Roland Kuhn

unread,
May 30, 2013, 10:26:02 AM5/30/13
to akka...@googlegroups.com
Hi Erik,

30 maj 2013 kl. 10:41 skrev Roland Kuhn:

Hi Erik,

30 maj 2013 kl. 00:41 skrev Erik Nelson:

This is a pretty big change, and totally invalidates the advice I was given that I could do what I needed with 2.0 via custom mailboxes. Hurray, more reimplementation!

I’m sorry to hear that; I tried finding your use-case in the archives but did not succeed, what exactly is it that you are modeling using these exceptions?

It is also not reflected in the current documentation or the migration guide - the migration guide does not mention the change, and http://doc.akka.io/docs/akka/2.1.4/scala/actors.html still has the now non-existant exception.

Okay, will fix. Thanks for pointing this out.

Actually I do not find that much to fix:

– the exception is correctly documented at http://doc.akka.io/docs/akka/2.1.4/java/untyped-actors.html#Stash

Regards,

Roland

Erik Nelson

unread,
Jun 11, 2013, 10:52:20 PM6/11/13
to <akka-user@googlegroups.com>
Hello, 

Apologies for the ornery hit-and-run email, I am in the middle of updating a very large codebase to scala 2.10, along with all of the required attendant library changes, and that brings quite a few headaches along with it, as you might imagine. That doesn't excuse my jerky tone, though. 

It turns out that for my particular use case the exception did not matter nearly as much as I thought. Thank you for updating the documentation!

I have another issue with extensions now that was introduced with 2.1 but I will start a new thread for that. 

 erik

Roland Kuhn

unread,
Jun 13, 2013, 11:16:46 AM6/13/13
to akka...@googlegroups.com
Hi Erik,

11 jun 2013 kl. 22:52 skrev Erik Nelson:

Hello, 

Apologies for the ornery hit-and-run email, I am in the middle of updating a very large codebase to scala 2.10, along with all of the required attendant library changes, and that brings quite a few headaches along with it, as you might imagine. That doesn't excuse my jerky tone, though. 

No worries, I know that upgrading can be stressful, and we are going to slow down the pace of changes to Akka’s core from now on.

It turns out that for my particular use case the exception did not matter nearly as much as I thought. Thank you for updating the documentation!

You’re welcome!

Regards,

Roland
Reply all
Reply to author
Forward
0 new messages