[erlang-questions] Kill process if message mailbox reaches a certain size (was discarding signals)

Ulf Wiger <>
Wed Jun 15 18:24:49 CEST 2011


I once made an experimental version of plain_fsm which could enforce a message queue limit.

http://erlang.org/pipermail/erlang-questions/2008-June/035571.html

I don't think I ever checked it in, but I remember that it wasn't terribly hard to implement.

Plain_fsm itself nowadays lives at: http://github.com/esl/plain_fsm

BR,
Ulf

On 15 Jun 2011, at 18:02, Mihai Balea wrote:

> Hi all,
> 
> Was reading the "discarding signals" thread and thought that maybe a better approach to handling this condition would be to kill the process if the mailbox exceeds a certain size.
> It seems to me that it would be a cleaner approach than flushing the mailbox and attempting to recover and it also fits better with Erlang's "let it crash" philosophy.
> 
> Basically, the way I see it, we'd have this implemented at system level. One could set a flag, similar to, say, fullsweep_after - either per process or system wide. Default could be infinity, which reverts to the current behavior.
> 
> Any thoughts on this? Any technical or philosophical arguments, pro or contra?
> 
> For the record, I do believe that one should try as hard as possible to avoid getting into this situation to begin with, but occasionally it happens and it is one of Erlang's more spectacular failure modes.
> 
> Cheers,
> Mihai
> 
> 
>>> If we are talking about an overloaded system that, for any reason, cannot tell the sender to reduce the traffic, then probably the only way to avoid a system crash is to discard the messages and notify the operators (raise an alarm, write event log, etc.) about this. So the discard shall be very quick as we are already overloaded. Do we have something for that?
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110615/91b35fe7/attachment.html>


More information about the erlang-questions mailing list