Closed DimaSalakhov closed 8 years ago
We'll uniform Quasar's selective receive (and call
, which is a special case) to that of Erlang/OTP and Elixir which, according to my tests, delay lifecycle messages until the request/response exchange is complete. This should also eliminate these problematic behaviors.
Sounds reasonable! :+1:
A more thorough summary of Erlang/OTP behavior during call
w.r.t. monitor/link: https://github.com/circlespainter/gen_server-experiments
I tried again with the latest Quasar 0.7.6-SNAPSHOT
build which includes the fix for https://github.com/puniverse/quasar/issues/187 (available on SonaType): the exit message from the watch seems now to be received correctly when calling receive
after call
, while in the link case the exception is still thrown as that's what Erlang/OTP does as well.
Closed by https://github.com/puniverse/quasar/commit/62d83b541bbdaeedf5c8d2ff431a6be7285e1363.
Both watch!
and link!
produce exit messages, when I trap
the actor. So will that behaviour still be true in the described case or link!
will throw me an exception instead?
Sorry, I had missed the "trap" part in your description. So now all cases you list will produce an exit message, instead if you link!
and do not :trap
you will get an exception while in call!
, which is consistent with what Erlang/OTP does as well.
beauty :fireworks: Thanks Fabio!
If actor1 is
call!
-ing a Server and observable acotr2 exits, then bad things happen.Scenario1: Actor1 watches Actor2 and traps lifetime events. Actor1 is calling Server1 and before Server1 responds, Actor2 exits. In that case Actor1 will never know about Actor2's death, this message will be thrown away inside call's SelectiveReceiveHelper.
Scenario2: Actor1 links Actor2 and traps lifetime events. Actor1 is calling Server1 and before Server1 responds, Actor2 exits. In that case unhandled exception will leak outside and kill all humans. Here is a stack trace:
Here is a small working example: