Stuff Goes Bad:Erlang In Anger

Unexpected Messages


Messages you didn’t know about tend to be rather rare when using OTP applications.
Because OTP behaviours pretty much expect you to handle anything with some clause in handle_info /2, unexpected messages will not accumulate much.
However, all kinds of OTP-compliant systems end up having processes that may not implement a behaviour, or processes that go in a non-behaviour stretch where it overtakes message handling.
If you’re lucky enough, monitoring tools 6 will show a constant memory increase, and inspecting for large queue sizes 7 will let you find which process is at fault.
You can then fix the problem by handling the messages as required.

 OTP applications里面几乎不存在出乎意料的消息。 因为OTP behaviours 会用handle_info/2来处理所有的消息,所以基本不会堆积很多不明的消息。

[6] See Section 5.1
[7] See Subsection 5.2.1