[erlang-questions] Erlang and Akka, The Sequel
Jesper Louis Andersen
Sat Apr 4 16:56:21 CEST 2015
On Sat, Apr 4, 2015 at 12:18 AM, José Valim <
> 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.
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.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions