[erlang-questions] inspect process mailbox size

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Thu Jan 3 10:07:21 CET 2013


The way to restrict a mailbox is to implement some kind of flow control on the mailbox to make sure it does not overflow. Currently, there is no way to limit the mailbox size - but do note that the VM makes sending messages to large mailboxes more expensive. This implements a somewhat rudimentary flow control and makes sure you need to screw up to a larger extent.

Jesper Louis Andersen
  Erlang Solutions Ltd., Copenhagen



On Dec 21, 2012, at 5:16 AM, Harsh J <qwertymaniac@REDACTED> wrote:

> I'm not aware of any way to do that (but please let me know if there
> is one). However, this past thread may be helpful to you:
> http://erlang.org/pipermail/erlang-questions/2011-June/059355.html
> 
> On Fri, Dec 21, 2012 at 8:52 AM, krad <humeafo@REDACTED> wrote:
>> a further question is, is there anyway to restrict the mailbox size?
>> 
>> On Sunday, February 1, 2009 3:11:14 AM UTC+8, Geoff Cant wrote:
>>> 
>>> Cliff Moon <cl...@REDACTED> writes:
>>> 
>>>> is there any way to inspect mailbox size at runtime?  Under load testing
>>>> I'm seeing conditions pop up where a node will go out of control due to
>>>> mailbox growth and it's rather hard to debug the issue post mortem from
>>>> crash dumps.
>>> 
>>> erlang:process_info/2 is very helpful for this:
>>> erlang:process_info(Pid, messages_queue_len) gives you the length of the
>>> queue and erlang:process_info(Pid, messages) gives you the queue itself.
>>> 
>>> A common cause of mailbox blowout is that the process is blocked waiting
>>> for a reply from something - in this case erlang:process_info(Pid,
>>> backtrace) and erlang:process_info(Pid, current_function) can help you
>>> figure out what it might be waiting for.
>>> 
>>> Cheers,
>>> --
>>> Geoff Cant
>>> 
>>> 
>> 
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>> 
> 
> 
> 
> -- 
> Harsh J
> http://harshj.com
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list