[erlang-questions] Kill process if message mailbox reaches a certain size (was discarding signals)
Thu Jun 16 14:43:39 CEST 2011
On Jun 16, 2011, at 1:09 AM, Jon Watte wrote:
> First, I assume that the proposal for "kill and restart" is to kill and restart the particular process that has an inbox that is "too full." This does not mean that the client crashes -- it means that those messages are lost. This is no different to how Erlang systems are robust in the face of rare crashing bugs (as opposed to, say, C++, where generally the entire system goes down because of a rare stray pointer bug, for example). Basically, crashing and re-starting an Erlang worker process is just one way of clearing out the message queue, and also making sure that any possible state corruption goes away because the process re-starts "afresh." The Erlang/OTP supervision tree is designed to work in this mode.
That is exactly what I was proposing.
When you kill just one offending process, you will probably lose one call (or transaction, etc ) but you don't bog down a scheduler or even an entire VM. Especially considering that processes with growing message queues tend to exhibit runaway memory consumption as well, which will eventually bring down the VM (see the thread Max mentioned).
More information about the erlang-questions