[erlang-questions] Semantics of send

Johan Montelius <>
Thu Apr 29 10:23:04 CEST 2010

On Wed, 28 Apr 2010 23:14:23 +0200, Richard Carlsson  
<> wrote:

>> What is the semantics of send?  In the following example:
>> to_a_or_to_ab_or_to_none(A, B) ->
>>     A ! foo,
>>     B ! bar,
>>     crash().
>> If B receives bar is it then so that A receives foo?
>There are no such guarantees unless A=B (that is, if both
> messages are from the same sender to the same receiver).

Not even then does it hold true.

On Thu, 29 Apr 2010 00:48:18 +0200, Richard O'Keefe <>  

>> And where is the behavior stated?
> Both the "Erlang Programming" book and the "Programming Erlang" book
> explain it, it's in the documentation, ...

Yes but not in the Reference Manual.

> transport between nodes is inherently unreliable.  Message
> transport _within_ a node is normally taken as reliable,
> but even then, it's possible for process A itself to die
> before all messages sent to it are delivered.

There is certainly a difference in reliability in the implementation of  
in-node message sending and ex-node sending. I (without having looked in  
the src) would think that it is guaranteed in the case above that if bar  
reached the message queue of B then foo reaches the message queue of A.

On Wed, 28 Apr 2010 16:43:45 +0200, Joe Armstrong <> wrote:

> ... Links between nodes are ultimately are
> layered on top of messaging - so even if a process dies, you cannot
> assume the exit will always be delivered.

I think we should be able to reply on some signals, signals that can be  
generated locally i.e.  DOWN/noconnection.

I know that reliable message sending is not guaranteed by the  
implementation but from the specification in the Reference Manual you  
would think it so. The statement in the Reference Manual is quite  
different from Barklund and Virding draft specification of Erlang 10.6.2:

"There are situations where it is not reasonable to require that all  
signals arrive at their destination, ..."

It is also different from Svensson and Fredlunds description in "A More  
Accurate Semantics for Distributed Erlang" where it is made clear that  
message sending between nodes is unreliable and that messages can be  

In the end there is of course always situations where you don't know if a  
message arrived or not but there are situations where you do know and you  
can also determine if it could be that a message was lost. I think the  
language should take advantage of this.

The semantic description of send should be tied to signals and especially  
the noconnection signal. If a message is possibly dropped then a  
noconnection signal should be sent to both the sender and receiver.

In the case above, if the sender receives a noconnection signal it knows  
that foo might not have arrived. A is also informed that messages could  
have been dropped (even if foo actually did arrive).

It could be that this is guaranteed by the system today and that is of  
course good but it should be in the specification of the language. If we  
had this then I think implementing fault tolerant distributed algorithms  
would be much easier. In stead of sending ack-messages on the application  
level one could rely on the fact that messages did arrive or a  
noconnection signal is generated.


Dr Johan Montelius
Royal Institute of Technology - KTH
School of Information and Communication Technology - ICT

More information about the erlang-questions mailing list