<feed xmlns='http://www.w3.org/2005/Atom'>
<title>otp.git/lib/diameter/src/base, branch master</title>
<subtitle>Mirror of Erlang/OTP repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/'/>
<entry>
<title>Add appup and code_change</title>
<updated>2019-04-14T14:21:40+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2019-04-14T13:20:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=82135c10177c9e773b1bc94c327f3744a9025491'/>
<id>82135c10177c9e773b1bc94c327f3744a9025491</id>
<content type='text'>
For the parent commit as a diameter 2.2 patch.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For the parent commit as a diameter 2.2 patch.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix inadvertently broad monitor</title>
<updated>2019-04-14T13:33:06+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2019-04-14T11:05:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=37df105ad012683de1de4a1db40818dde9c7f3bd'/>
<id>37df105ad012683de1de4a1db40818dde9c7f3bd</id>
<content type='text'>
Commit d9d918b2 added a gen_server whose purpose is to keep track of
visible nodes on which diameter_dist:attach/1 has been called to
register a node as a handler of incoming Diameter requests when
diameter_dist:route_session/2 is configured as spawn_opt MFA. The server
contacts visible nodes at init in order to request information, but
instead of monitoring visible to also be able to request information at
nodeup, it monitored on all nodes, resulting in gen_server casts even to
hidden nodes.

Monitor only on visible nodes since a hidden node may not be able to
deal with the new message.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit d9d918b2 added a gen_server whose purpose is to keep track of
visible nodes on which diameter_dist:attach/1 has been called to
register a node as a handler of incoming Diameter requests when
diameter_dist:route_session/2 is configured as spawn_opt MFA. The server
contacts visible nodes at init in order to request information, but
instead of monitoring visible to also be able to request information at
nodeup, it monitored on all nodes, resulting in gen_server casts even to
hidden nodes.

Monitor only on visible nodes since a hidden node may not be able to
deal with the new message.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'anders/diameter/distribution/OTP-15398' into maint</title>
<updated>2019-03-08T10:39:24+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2019-03-08T10:39:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=ce56d9bfef133df1ecc5b88e274500f7d0d87257'/>
<id>ce56d9bfef133df1ecc5b88e274500f7d0d87257</id>
<content type='text'>
* anders/diameter/distribution/OTP-15398:
  Add diameter_dist_SUITE to exercise diameter_dist:route_session/2
  Add consistent hashing to diameter_dist:route_session/2
  Add options to diameter_dist:route_session/2 node selection
  Add diameter_dist for ready spawn_opt callbacks
  Tweak/document request handler callback
  Document acknowledgements in transport interface
  Fix comment typo
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* anders/diameter/distribution/OTP-15398:
  Add diameter_dist_SUITE to exercise diameter_dist:route_session/2
  Add consistent hashing to diameter_dist:route_session/2
  Add options to diameter_dist:route_session/2 node selection
  Add diameter_dist for ready spawn_opt callbacks
  Tweak/document request handler callback
  Document acknowledgements in transport interface
  Fix comment typo
</pre>
</div>
</content>
</entry>
<entry>
<title>Add consistent hashing to diameter_dist:route_session/2</title>
<updated>2019-03-06T16:42:44+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2019-03-06T16:13:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=376e8fac401bd11b3cb3d2f9661eb7ff0b9bbcd7'/>
<id>376e8fac401bd11b3cb3d2f9661eb7ff0b9bbcd7</id>
<content type='text'>
If the Session-Id optional value to node() mapping fails then hash
Session-Id to a node by default, instead of selecting the local node as
in the parent commit. The previous behaviour is configurable by setting
default = local in an options map.

Nodes make themselves part of the pool from which nodes are selected by
calling diameter_dist:attach/1 with the list of service names they are
willing to handle requests for, the local node being selected in the
absence of any attached nodes. The original idea was to base the node
pool on share_peers and/or use_shared_peers configuration, but that
configuration determines where outgoing requests can be sent, while
route_session/2 deals with incoming requests, so it's not obvious that
conflating the two is a good thing. (Also because
share_peers/use_shared_peers can be used in different ways; the former
could have been skipped entirely.)

The hashing effectively places nodes on a circle, a hashed Session-Id
being mapped to the nearest predecessor node (clockwise). Nodes are
rehashed with each Session-Id (with the id as salt) for a more even
distribution, at the cost of performance, although how high the cost or
how even the distribution has yet to be tested. Obviously, the larger
the number of attached nodes, the higher the cost. Adding/removing an
attached node only affects session ids that hash in the interval between
the added/removed node and its successor (hence consistent hashing).

Options are tweaked slightly compared to the parent commit, and it is
now possible to restrict the optional value mapping to specific Diameter
identities, to avoid mapping an id that was generated at the peer when
the peer is also implemented with the diameter application.

Note that diameter_dist is not yet an officially documented interface,
so could change. Documentation is in the module itself.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the Session-Id optional value to node() mapping fails then hash
Session-Id to a node by default, instead of selecting the local node as
in the parent commit. The previous behaviour is configurable by setting
default = local in an options map.

Nodes make themselves part of the pool from which nodes are selected by
calling diameter_dist:attach/1 with the list of service names they are
willing to handle requests for, the local node being selected in the
absence of any attached nodes. The original idea was to base the node
pool on share_peers and/or use_shared_peers configuration, but that
configuration determines where outgoing requests can be sent, while
route_session/2 deals with incoming requests, so it's not obvious that
conflating the two is a good thing. (Also because
share_peers/use_shared_peers can be used in different ways; the former
could have been skipped entirely.)

The hashing effectively places nodes on a circle, a hashed Session-Id
being mapped to the nearest predecessor node (clockwise). Nodes are
rehashed with each Session-Id (with the id as salt) for a more even
distribution, at the cost of performance, although how high the cost or
how even the distribution has yet to be tested. Obviously, the larger
the number of attached nodes, the higher the cost. Adding/removing an
attached node only affects session ids that hash in the interval between
the added/removed node and its successor (hence consistent hashing).

Options are tweaked slightly compared to the parent commit, and it is
now possible to restrict the optional value mapping to specific Diameter
identities, to avoid mapping an id that was generated at the peer when
the peer is also implemented with the diameter application.

Note that diameter_dist is not yet an officially documented interface,
so could change. Documentation is in the module itself.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add options to diameter_dist:route_session/2 node selection</title>
<updated>2019-03-06T16:33:02+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2019-03-04T16:31:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=734a7daf2e556d684850a3cb278684ba522a29de'/>
<id>734a7daf2e556d684850a3cb278684ba522a29de</id>
<content type='text'>
To be able to restrict how many AVPs will be examined (from the front of
a message) when looking for Session-Id, and to decide what to do with if
the AVP isn't found. Options are specified as a map of the following
form.

  #{search =&gt; non_neg_integer(),
    default =&gt; discard | mfa(),
    dispatch =&gt; list() | mfa()}

The search member says how many AVPs to examine at most, from the front
of the message. If the optional value of a Session-Id is not the name of
a connected node then the default member determines what to do with the
request, handle it locally (the default), discard it, or invoke an MFA
on the Session-Id | false (if none was found) and diameter_packet record
to return a node() | false; if the latter then the request is discarded.

If a node is identified then the dispatch MFA is invoked on the node and
the request MFA (as three arguments), a list Opts being equivalent to
the MFA {erlang, spawn_opt, [Opts]}, and the default being the empty
list.

Integer- or list-valued options are equivalent to the corresponding map
with a single value.

Limiting the search is to avoid searching messages containing many AVPs
for a Session-Id that is known to occur near the header, since section
8.8 of RFC 6733 says this:

   When present, the Session-Id SHOULD appear immediately
   following the Diameter header (see Section 3).

There's no guarantee, but in practice it may well be known that peers
are respecting the RFC, and in that case limiting the search is a
defense against searching messages from a malicious peer unnecessarily.
The search is unlimited by default.

A default is only used when a search fails to locate a Session-Id, and
can be to discard the message, or have a node() or false be returned
from an MFA applied to the diameter_packet in question. The local node
is chosen by default.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To be able to restrict how many AVPs will be examined (from the front of
a message) when looking for Session-Id, and to decide what to do with if
the AVP isn't found. Options are specified as a map of the following
form.

  #{search =&gt; non_neg_integer(),
    default =&gt; discard | mfa(),
    dispatch =&gt; list() | mfa()}

The search member says how many AVPs to examine at most, from the front
of the message. If the optional value of a Session-Id is not the name of
a connected node then the default member determines what to do with the
request, handle it locally (the default), discard it, or invoke an MFA
on the Session-Id | false (if none was found) and diameter_packet record
to return a node() | false; if the latter then the request is discarded.

If a node is identified then the dispatch MFA is invoked on the node and
the request MFA (as three arguments), a list Opts being equivalent to
the MFA {erlang, spawn_opt, [Opts]}, and the default being the empty
list.

Integer- or list-valued options are equivalent to the corresponding map
with a single value.

Limiting the search is to avoid searching messages containing many AVPs
for a Session-Id that is known to occur near the header, since section
8.8 of RFC 6733 says this:

   When present, the Session-Id SHOULD appear immediately
   following the Diameter header (see Section 3).

There's no guarantee, but in practice it may well be known that peers
are respecting the RFC, and in that case limiting the search is a
defense against searching messages from a malicious peer unnecessarily.
The search is unlimited by default.

A default is only used when a search fails to locate a Session-Id, and
can be to discard the message, or have a node() or false be returned
from an MFA applied to the diameter_packet in question. The local node
is chosen by default.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add diameter_dist for ready spawn_opt callbacks</title>
<updated>2019-03-06T16:31:11+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2019-02-20T00:42:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=d9d918b2e31daca8b3d904ffbd26a9e4207b166f'/>
<id>d9d918b2e31daca8b3d904ffbd26a9e4207b166f</id>
<content type='text'>
That is, of functions that can be configured as spawn_opt MFAs in
transport configuration.

This commits adds the spawn_local described in the parent commit, and a
route_session that assumes that the local node initiates all sessions
with Session-Id returned by diameter:session_id/1, and handles incoming
requests on the node on which the id in question was returned,
diameter:session_id/1 using node() as optional value in the Session-Id
format.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
That is, of functions that can be configured as spawn_opt MFAs in
transport configuration.

This commits adds the spawn_local described in the parent commit, and a
route_session that assumes that the local node initiates all sessions
with Session-Id returned by diameter:session_id/1, and handles incoming
requests on the node on which the id in question was returned,
diameter:session_id/1 using node() as optional value in the Session-Id
format.
</pre>
</div>
</content>
</entry>
<entry>
<title>Tweak/document request handler callback</title>
<updated>2019-03-06T16:28:36+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2019-01-18T12:22:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=f1cdd72110184460f76630db79ce6fc0ead44ba6'/>
<id>f1cdd72110184460f76630db79ce6fc0ead44ba6</id>
<content type='text'>
The possibility of configuring an MFA as spawn_opt was added in commit
fd285079, the callback being passed an arity-0 fun to be applied in an
appropriate handler process. Replace the fun by a tuple to be passed to
diameter_traffic:request/1, to avoid passing funs between nodes when
handler processes are remote.

A list-valued spawn_opt is now equivalent to the following configured as
{spawn_opt, {Mod, spawn_local, [Opts]}}.

  spawn_local(ReqT, Opts) -&gt;
      spawn_opt(diameter_traffic, request, [ReqT], Opts).

ReqT is passed by diameter and contains information that the callback
may want to decide where to handle the request in question (which wasn't
accessible with a fun), but this information isn't exposed in a
documented way. The intention is instead to add an own callback
implementation to make use of the information.

Note that application lookup now takes place in the watchdog process in
both the list-valued (or no configuration) and mfa-valued cases. Whether
this is good, bad, or (probably) inconsequential remains to be seen.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The possibility of configuring an MFA as spawn_opt was added in commit
fd285079, the callback being passed an arity-0 fun to be applied in an
appropriate handler process. Replace the fun by a tuple to be passed to
diameter_traffic:request/1, to avoid passing funs between nodes when
handler processes are remote.

A list-valued spawn_opt is now equivalent to the following configured as
{spawn_opt, {Mod, spawn_local, [Opts]}}.

  spawn_local(ReqT, Opts) -&gt;
      spawn_opt(diameter_traffic, request, [ReqT], Opts).

ReqT is passed by diameter and contains information that the callback
may want to decide where to handle the request in question (which wasn't
accessible with a fun), but this information isn't exposed in a
documented way. The intention is instead to add an own callback
implementation to make use of the information.

Note that application lookup now takes place in the watchdog process in
both the list-valued (or no configuration) and mfa-valued cases. Whether
this is good, bad, or (probably) inconsequential remains to be seen.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix comment typo</title>
<updated>2019-03-06T09:44:32+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2019-01-15T11:21:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=9589d10c491f2660995a8424c21d6d72a198c315'/>
<id>9589d10c491f2660995a8424c21d6d72a198c315</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'anders/diameter/nocatch/OTP-15569' into maint</title>
<updated>2019-02-13T11:40:26+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2019-02-13T11:40:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=664d6d92f7b4d5c6b328f6e3503d372af70d74d6'/>
<id>664d6d92f7b4d5c6b328f6e3503d372af70d74d6</id>
<content type='text'>
* anders/diameter/nocatch/OTP-15569:
  Update appup
  Fix nocatch on incoming answer with faulty Experimental-Result-Code
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* anders/diameter/nocatch/OTP-15569:
  Update appup
  Fix nocatch on incoming answer with faulty Experimental-Result-Code
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix nocatch on incoming answer with faulty Experimental-Result-Code</title>
<updated>2019-02-08T13:35:37+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2019-02-08T08:34:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=6217e81657d98323f2be5f1bcb9cd76fcee13069'/>
<id>6217e81657d98323f2be5f1bcb9cd76fcee13069</id>
<content type='text'>
Failure to decode the Grouped AVP results in a throw from module
diameter_gen, which is caught in the normal message decode, but wasn't
when only the AVP is decoded from diameter_traffic (for error checking
and counter increment). The result was no handle_answer/error
callback, and an error return from diameter:call/4 when the detach
option was not specified.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Failure to decode the Grouped AVP results in a throw from module
diameter_gen, which is caught in the normal message decode, but wasn't
when only the AVP is decoded from diameter_traffic (for error checking
and counter increment). The result was no handle_answer/error
callback, and an error return from diameter:call/4 when the detach
option was not specified.
</pre>
</div>
</content>
</entry>
</feed>
