From 9a7df41a9e5361049a17c8aa971b52599fba2632 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 19 Sep 2018 16:37:55 +0200 Subject: erts: Move reason in dist messages to payload The dist messages EXIT, EXIT2 and MONITOR_DOWN have been updated with new versions that send the reason term as part of the payload of the message instead of as part of the control message. This allows the decode of the reason to be done by the receiving process instead of the dist entry which in turn makes it possible for multiple decodes to be done in parallel. This change is done in order to make it easier to fragment the potentially large payload of EXIT, EXIT2 and MONITOR_DOWN into multiple distribution messages. OTP-15611 --- erts/doc/src/erl_dist_protocol.xml | 114 ++++++++++++++++++++++++++++++++----- 1 file changed, 99 insertions(+), 15 deletions(-) (limited to 'erts/doc/src/erl_dist_protocol.xml') diff --git a/erts/doc/src/erl_dist_protocol.xml b/erts/doc/src/erl_dist_protocol.xml index c90c8f9521..cf515795b4 100644 --- a/erts/doc/src/erl_dist_protocol.xml +++ b/erts/doc/src/erl_dist_protocol.xml @@ -532,11 +532,7 @@ io:format("old/unused name ~ts at port ~p, fd = ~p ~n", Distribution Handshake

This section describes the distribution handshake protocol introduced - in Erlang/OTP R6. This description was previously located in - $ERL_TOP/lib/kernel/internal_doc/distribution_handshake.txt and - has more or less been copied and "formatted" here. It has been almost - unchanged since 1999, but the handshake has not changed much since then - either.

+ in Erlang/OTP R6. The handshake has remaining almost the same since then.

General @@ -847,6 +843,18 @@ DiB == gen_digest(ChA, ICA)? of the SEND_TT control message.

+ -define(DFLAG_BIG_SEQTRACE_LABELS, 16#100000). + +

The node understands any term as the seqtrace label.

+
+ -define(DFLAG_EXIT_PAYLOAD, 16#400000). + +

Use the PAYLOAD_EXIT, PAYLOAD_EXIT_TT, + PAYLOAD_EXIT2, PAYLOAD_EXIT2_TT + and PAYLOAD_MONITOR_P_EXIT + control messages + instead of the non-PAYLOAD variants.

+

There is also function dist_util:strict_order_flags/0 @@ -859,7 +867,7 @@ DiB == gen_digest(ChA, ICA)?

Protocol between Connected Nodes -

As from ERTS 5.7.2 the runtime system passes a distribution flag +

Since ERTS 5.7.2 (OTP R13B) the runtime system passes a distribution flag in the handshake stage that enables the use of a distribution header on all messages passed. Messages passed between nodes have in @@ -878,7 +886,7 @@ DiB == gen_digest(ChA, ICA)? ControlMessage Message - Format of Messages Passed between Nodes (as from ERTS 5.7.2) + Format of Messages Passed between Nodes (as from ERTS 5.7.2 (OTP R13B)) @@ -887,15 +895,23 @@ DiB == gen_digest(ChA, ICA)?

Equal to d + n + m.

+ DistributionHeader + +

+ Distribution header + describing the atom cache. + +

+
ControlMessage

A tuple passed using the external format of Erlang.

Message -

The message sent to another node using the '!' (in external format). - Notice that Message is only passed in combination with a - ControlMessage encoding a send ('!').

+

The message sent to another node using the '!' + or the reason for a EXIT, EXIT2 or DOWN signal using + the external term format.

@@ -903,7 +919,7 @@ DiB == gen_digest(ChA, ICA)? number is omitted from the terms that follow a distribution header .

-

Nodes with an ERTS version earlier than 5.7.2 does not pass the +

Nodes with an ERTS version earlier than 5.7.2 (OTP R13B) does not pass the distribution flag that enables the distribution header. Messages passed between nodes have in this case the following format:

@@ -920,7 +936,7 @@ DiB == gen_digest(ChA, ICA)? ControlMessage Message - Format of Messages Passed between Nodes (before ERTS 5.7.2) + Format of Messages Passed between Nodes (before ERTS 5.7.2 (OTP R13B)) @@ -1007,7 +1023,7 @@ DiB == gen_digest(ChA, ICA)?

{16, FromPid, Unused, ToName, TraceToken}

Followed by Message.

Unused is kept for backward compatibility.

- + EXIT2_TT

{18, FromPid, ToPid, TraceToken, Reason}

@@ -1061,7 +1077,7 @@ DiB == gen_digest(ChA, ICA)?

{22, FromPid, ToPid}

Followed by Message.

- This control messages replace the SEND control + This control message replaces the SEND control message and will be sent when the distribution flag DFLAG_SEND_SENDER has been negotiated in the connection setup handshake. @@ -1080,7 +1096,7 @@ DiB == gen_digest(ChA, ICA)?

{23, FromPid, ToPid, TraceToken}

Followed by Message.

- This control messages replace the SEND_TT control + This control message replaces the SEND_TT control message and will be sent when the distribution flag DFLAG_SEND_SENDER has been negotiated in the connection setup handshake. @@ -1097,4 +1113,72 @@ DiB == gen_digest(ChA, ICA)?

+
+ New Ctrlmessages for Erlang/OTP 22 +

+ Messages encoded before the connection has + been set up may still use the non-PAYLOAD variant. + However, once a PAYLOAD control message has been sent, + no more non-PAYLOAD control messages will be sent in + the same direction on the connection. +

+ + PAYLOAD_EXIT + +

{24, FromPid, ToPid}

+

Followed by Reason.

+

+ This control message replaces the EXIT control + message and will be sent when the distribution flag + DFLAG_EXIT_PAYLOAD + has been negotiated in the connection setup handshake. +

+
+ PAYLOAD_EXIT_TT + +

{25, FromPid, ToPid}

+

Followed by Reason.

+

+ This control message replaces the EXIT_TT control + message and will be sent when the distribution flag + DFLAG_EXIT_PAYLOAD + has been negotiated in the connection setup handshake. +

+
+ PAYLOAD_EXIT2 + +

{26, FromPid, ToPid}

+

Followed by Reason.

+

+ This control message replaces the EXIT2 control + message and will be sent when the distribution flag + DFLAG_EXIT_PAYLOAD + has been negotiated in the connection setup handshake. +

+
+ PAYLOAD_EXIT2_TT + +

{27, FromPid, ToPid}

+

Followed by Reason.

+

+ This control message replaces the EXIT2_TT control + message and will be sent when the distribution flag + DFLAG_EXIT_PAYLOAD + has been negotiated in the connection setup handshake. +

+
+ PAYLOAD_MONITOR_P_EXIT + +

{28, FromPid, ToPid, Ref}

+

Followed by Reason.

+

+ This control message replaces the MONITOR_P_EXIT control + message and will be sent when the distribution flag + DFLAG_EXIT_PAYLOAD + has been negotiated in the connection setup handshake. +

+
+
+
+ -- cgit v1.2.3