[erlang-questions] gen_server mailbox scans

Chandru chandrashekhar.mullaparthi@REDACTED
Thu Jan 15 05:58:44 CET 2009

2009/1/14 Ben Hood <0x6e6562@REDACTED>

> Hi,
> The issue of excessive mailbox scanning during the bottom half of a
> gen_server call has been brought up at various stages on this list.
> The issue has become of some concern to us, so we have patched the
> gen_server implementation from R11B5 to drain the mailbox in the loop.
> It seems to do the job but I just wanted to get some feedback from
> more knowledgable people before this functionality is merged into our
> main source tree.
> The patched version is available here:
> http://hg.rabbitmq.com/rabbitmq-server/file/06b16fb29a1c/src/gen_server2.erl
> Any remarks or help is appreciated,

>From a callback point of view, the changes are probably transparent, but:

* process_info(Pid, message_queue_len) will probably lie now because the
mailbox has been drained into an internal queue. If your message queue is
indeed building up in a message storm, diagnosing the problem will become
more difficult.

* And if you did a sys:get_status(Pid) on the gen_server, you will copying
the entire message queue just to view it...

* Crash reports will be MUCH bigger.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090115/097d5b69/attachment.htm>

More information about the erlang-questions mailing list