<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 4, 2015 at 12:18 AM, José Valim <span dir="ltr"><<a href="mailto:jose.valim@plataformatec.com.br" target="_blank">jose.valim@plataformatec.com.br</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>We have actually discussed this extensively. We have decided to not handle those cases because similar errors happen if you wrap a gen_server:call/3 in a catch. If you trigger the call timeout and catch it, the gen server is going to eventually reply which will sit in your inbox. We believe there is one httpc bug caused due to this (anti-)pattern.</div><div></div></blockquote></div><br>I'm not sure it is possible to avoid "late-arriving" messages. By the two-generals problem, we can't make a system which can safely cancel the message, but we will have to rely on a timeout. Once we rely on the timeout, we must have a way to remove messages which arrive late because it breaks with the contract between the caller and callee.</div><div class="gmail_extra"><br></div><div class="gmail_extra">In other words, you will need a "collector" case in your gen_server which can evict those late-arriving messages out of the mailbox, whenever you start catching rather than dying. There is currently no way in Erlang to "mask" what references arriving the mailbox are ok, and which should be silently removed. But perhaps there should be.<br clear="all"><div><br></div>-- <br><div class="gmail_signature">J.</div>
</div></div>