[erlang-questions] inspect process mailbox size

Geoff Cant <>
Sat Jan 31 20:11:14 CET 2009


Cliff Moon <> 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




More information about the erlang-questions mailing list