<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>What we're talking about here are byzantine failures, and despite a huge body of research on these topics, there are no fool-proof answers or solutions.</div><div><br></div><div>Erlang does not use ACKs implicitly - sending a message to a process is an asynchronous (fire and forget) action and no implicit reply channel exists. This is a deliberate design decision, since making various levels of guarantee about delivery is not a core requirement, but rather, an application specific need.</div><div><br></div><div>You ask what "happens if the receiver is not able to notify the world about its death", and this is handled in two ways by erlang's runtime system. If the receiver is a local process (i.e., resides on the same physical emulator) then as soon as it exits, any monitors that have been set up (by other processes) will be triggered and a message sent to the subscribers. If the receiver resides on another node (whether physically on the same host or not) then monitors are managed at both ends and when the remote process dies, monitor notifications are sent across the wire to subscribers. If the receiver resides on another node and the network link dies, then the net_kernel's tick timer will detect the disconnect (after a default timeout) and once it considers the node to have been disconnected, will fire monitor notifications to all (local) subscribers.</div><div><br></div><div>In terms of guarantees about delivery, in practise these are impossible to make without certain caveats. Guaranteed "exactly once" delivery, for example, is a promise that cannot be made without theoretically infinite storage capacity being available for all participants. In practise one can "get away with" finite storage capacity, but that means under certain circumstances, the promise/guarantee won't hold.</div><div><br></div><div>The way to 'ensure' a message has arrived across a distribution link then, is to expect an ACK. You must wait a potentially infinite time until that ACK arrives before considering the message delivered, unless you see a monitor notification indicating the receiver's death, at which point you might re-send once the receiver comes back online. Even then, you cannot be sure if the receiver did in fact see the message *and* sent an ACK, but the network link died before the ACK was delivered. In this case, you'll have to re-send anyway - since you've no way of knowing message was actually delivered, having not seen the lost ACK - and the receiver will have to de-dup the message(s) at his end.</div><div><br></div><div>Other configurations are possible. Introducing a ring overlay, you can achieve atomic broadcast with two round trips, one for delivery and another for ACK, though you'd have to either have each node take responsibility for its neighbours messages (and ACKs) during group membership changes, or make group membership changes atomic by using distributed transactions (e.g., paxos, etc). There is a definite cost to adding these kind of guarantees.</div><div><br></div><div>Viz your observation about wanting to make delivery atomic, in practise many solutions go the asynchronous route in order to avoid the performance (and latency) overheads of distributed transactions.</div><div><br></div><div>If you want to use ACKs in your erlang code, you can either implement this yourself or use gen_server:call to make a synchronous invocation that waits on a response (and monitors the server). This will not only throttle the producer, but will also make the server a bottleneck in the system, since it can only handle one message at once.</div><div><br></div><div>Cheers,</div><div>Tim</div><br><div><div>On 5 Jul 2013, at 12:23, <a href="mailto:jeti789@web.de">jeti789@web.de</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>I see. What happens if the receiver is not able to notify the world about its death? The sender after a timeout sends a notification out about a possible death? The supervisor detects that there is no more heart beat? Not wanting to be pedantic. Just trying to understand how this works. Is there some document/book where you can read about those things. I like that kind of problems ;-).</div>

<div> </div>

<div>Regards, Oliver</div>

<div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div name="quoted-content">In practice you just subscribe to notification of receivers death. It<br>
does not solve a case when your receiver is overflowed with work, but<br>
it is solved by careful planning of flow of messages in your<br>
application.</div>

<div name="quoted-content"> </div>

<div name="quoted-content"><br>
On Fri, Jul 5, 2013 at 10:27 AM, <<a href="mailto:jeti789@web.de">jeti789@web.de</a>> wrote:<br>
> I just happened to read the thesis of Joe Armstrong and don't have much<br>
> prior knowledge of Erlang. I wonder what happens if a delivery receipt for<br>
> some message never arrives. What does the sending actor do? It sends the<br>
> message another time? This could confuse the recipient actor when it<br>
> receives the same message another time. It has to be able to tell that its<br>
> receipt was not received and therefore the second message is void.<br>
><br>
> That kind of problems always kept me away from solutions where message<br>
> delivery is not transactional. I think I know the answer: the sending actor<br>
> tells its supervising actor that something must be wrong when it didn't<br>
> obtain a receipt in reasonable time causing the supervisor to take some<br>
> action (like restarting the involed actors or something). Is this correct? I<br>
> see no other solution that doesn't result in theroretically possible<br>
> infinite message sends.<br>
><br>
> Thanks for any answer,<br>
><br>
> Bienlein<br>
><br>
><br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
<br>
<br>
<br>
--<br>
Best regards,<br>
Paul Peregud<br>
+48602112091</div>
</div>
</div>
</div></div></div>
_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://erlang.org/mailman/listinfo/erlang-questions<br></blockquote></div><br></body></html>