message passing - What guarantees does erlang's "monitor" give? -
while reading erts user's guide, found section:
the signal ordering guarantee given following. if entity sends multiple signals same destination entity, order preserved. is, if sends signal s1 b, , later sends signal s2 b, s1 guaranteed not arrive after s2.
i've happened across while doing farther research googling:
erlang reference manual, 13.5:
message sending asynchronous , safe, message guaranteed reach recipient, provided recipient exists.
that seems vague , i'd know guarantees can rely on in next scenario:
a,b processes on 2 different nodes. assume not crash , b valid node @ point. , b monitor each other. sends messages m1,m2,m3 b
in above scenario, possible b receives m1,m3 (m2 dropped), without sort of 'down'/'exit'/heartbeat timeout beingness received @ a?
there no other guarantees other ordering guarantee. note default don't know sender is, unless sender encodes in message.
your illustration happen:
a sends m1 , m2 b receives m1 the node on b resides gets disconnected the node on b resides comes again a sends m3 b b receives m3m2 can lost on network link in scenario. highly unlikely happens, can happen. usual trick have kind of notion of such errors. either having timeout trigger, or monitoring node or pid recipient of message.
updated scenario:in updated scenario, provided read correctly, 'down'
style message @ point, , likewise, message telling node again, if monitor node.
though often, such things improve modeled using idempotent protocol if @ possible.
erlang message-passing
No comments:
Post a Comment