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来处理所有的消息,所以基本不会堆积很多不明的消息。
 然而,并不是所有服从OTP的系统都会实现behaviour的中指定的函数(编:如handle_info/2),或不符合behaviour的进程没有做好(overtakes)消息处理.
 如果你足够幸运,监控工具6会监测到噌噌往上涨的内存,你可以通过检查大型队列7来找出哪个进程出错了。
 那么你按需求处理好这些消息(没有被处理的)就可以修复问题啦。

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

[注6]:见5.1
[注7]:见5.2.1