[erlang-questions] What is Cookie in distribution message as in {2, Cookie, ToPid}?

Lukas Larsson lukas@REDACTED
Thu Jul 10 14:21:21 CEST 2014


Hello,

On Thu, Jul 10, 2014 at 9:07 AM, Leo Liu <sdl.web@REDACTED> wrote:

> http://www.erlang.org/doc/apps/erts/erl_dist_protocol.html Mentions
> `cookie' in the handshake and also in the messages between connected
> nodes.
>
> Since cookie is not sent in clear text it is odd to see it used in:
>
> SEND
>
>     {2, Cookie, ToPid}
>
> REG_SEND
>
>     {6, FromPid, Cookie, ToName}
>

The cookies in the messages are currently unused and should always be set
to the atom ''. It is afaik there for the possibility to use cookie
authentication in non-stream based protocols.


>
> Ideas? Also what are the differences between EXIT and EXIT2:
>
> EXIT
>
>     {3, FromPid, ToPid, Reason}
>
> EXIT2
>
>     {8, FromPid, ToPid, Reason}


EXIT is generated when an exit signal is sent because a process that was
linked over distribution crashed. EXIT2 is send when the bif exit/2 is used
on a remote pid.


> How to instruct an Erlang node to log distribution messages it receives?
>

There are a bunch of dtrace/systemtap probes available that you can use to
inspect the distribution messages. Also there is a define called
ERTS_DIST_MSG_DBG in dist.c that you can set to make the code printout any
messages that it receive.

Lukas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140710/27b9fdc5/attachment.htm>


More information about the erlang-questions mailing list