aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src
AgeCommit message (Collapse)Author
2017-03-08Merge branch 'anders/diameter/capx_strictness/OTP-14257' into maintAnders Svensson
* anders/diameter/capx_strictness/OTP-14257: Add transport_opt() capx_strictness
2017-03-08Merge branch 'anders/diameter/19.3/OTP-14252' into maintAnders Svensson
* anders/diameter/19.3/OTP-14252: vsn -> 1.12.2 Update appup for 19.3
2017-03-08Add transport_opt() capx_strictnessAnders Svensson
To allow the Peer State Machine requirement that only the expected capabilities exchange message be received in the relevant state to be relaxed. If {capx_strictness, false} is configured then anything bu the expected CER/CEA is ignored. This is non-standard behaviour, and thusfar undocumented. Use at your own risk.
2017-03-07Avoid sending large terms between nodes unnecessarilyAnders Svensson
When relaying outgoing requests through transport on a remote node, terms that were stripped when sending to the transport process weren't stripped when spawning a process on the remote node. Also, don't save the request to the process dictionary in a process that just relays an answer.
2017-03-07Don't use request table for answer routingAnders Svensson
The table has existed forever, to route incoming answers to a waiting request process: each outgoing request writes to the table, and each incoming answer reads. This has been seen to suffer from lock contention at high load however, so this commit moves the routing into the diameter_peer_fsm processes that are diameter's conduit to transport processes. The request table is still used for failover detection, but entries are only written when a watchdog state transitions leaves or enters state OKAY.
2017-03-03Update appup for 19.3Anders Svensson
OTP-14206 fix 19.1 failover blunder, use diameter_request less
2017-02-24Fix/redo failover optimizationAnders Svensson
Commit 9a878743 addressed inefficiency at failover, but introduced inefficiency in the sending of outgoing requests in so doing: each outgoing request added an request table entry keyed on a transport pid, then looked for a specific element with this key, and then (later) removed the inserted element. Since the request table is a bag, this results in linear searches over a potentially long list of element keyed on the same pid. The higher the rate of outgoing calls, the more costly it becomes. Instead of writing entries to the request table, the peer_up/down calls to diameter_traffic that mirror transitions to and from the OKAY state in the RFC 3539 watchdog state machine now result in a process for request processes to monitor in order to detect failover.
2016-12-07Update copyright-yearErlang/OTP
2016-09-12Merge branch 'anders/diameter/19.1/OTP-13838' into maintAnders Svensson
* anders/diameter/19.1/OTP-13838: vsn -> 1.12.1 Update appup for 19.1 Fix xmllint errors in documentation Remove documentation overkill Don't run traffic tests in parallel when {string_decode, true} Remove copyright from generated dictionary modules Fix dictionary function typo Fix dictionary typo in relay example
2016-09-12Merge branch 'anders/diameter/failover/OTP-13412' into maintAnders Svensson
* anders/diameter/failover/OTP-13412: Make peer failover more efficient
2016-09-12Merge branch 'anders/diameter/min_heap_size/OTP-13796' into maintAnders Svensson
* anders/diameter/min_heap_size/OTP-13796: Let unfortunate min_heap_size setting be disabled
2016-09-12Merge branch 'anders/diameter/19/listen/OTP-13787' into maintAnders Svensson
* anders/diameter/19/listen/OTP-13787: Close listening sockets at service death
2016-09-11Update appup for 19.1Anders Svensson
OTP-13412 more efficient peer failover OTP-13787 close listening sockets OTP-13796 min_heap_size OTP-13838 typo in diameter_traffic No load order requirements.
2016-09-11Let unfortunate min_heap_size setting be disabledAnders Svensson
The setting in all diameter server processes has existed since the beginning of time. Whether it's actually useful is questionable, but it does lead to increased memory usage, especially if there are many peer connections whose processes wouldn't otherwise be large. Let the setting be disabled with -diameter min_heap_size false. (Or any value that isn't a non-negative integer.) The diameter application itself only calls diameter_lib:spawn_opts(server, []), but let other arguments remain for backwards compatibility, since diameter_lib:spawn_opts/2 has been abused from outside of diameter.
2016-08-26Close listening sockets at service deathAnders Svensson
Commit 5ca5fb71 ensured that they were closed immediately at transport removal, but in so doing broke their closing at stop service completely, by removing the timer that caused sockets to be closed even belatedly. Monitor on the service process to make it happen. This could still be improved, since stop_service listening ports aren't closed until after the service process has died. They could be closed earlier in the case of stop_service.
2016-08-26Remove copyright from generated dictionary modulesAnders Svensson
The copyright was a historical remnant of diameter's roots prior to its inclusion in OTP. Thanks to Anatolie Golovco.
2016-08-26Fix dictionary function typoAnders Svensson
It's '#get-'/2, not 'get-'/2. Only failed if the dictionary in question defined no Failed-AVP, which is rarely the case in practice. Thanks to Ferenc Holzhauser.
2016-06-15Don't make assumptions about build tools pathsAlexey Lebedeff
One more followup to https://github.com/erlang/otp/pull/1056 and https://github.com/erlang/otp/pull/1023 This time it's about `/usr/bin/env` and `/bin/cp`: - `/usr/bin/env` in `diameterc` was used to find the bootstrapped `escript` executable. Changed it to exlpicit call to `escript` in Makefile. - `/usr/bin/env` and `/bin/cp` were referenced in documentation build/install process. Now full paths to this tools are injected using autoconf magic.
2016-06-12Merge branch 'anders/diameter/rand/OTP-13664'Anders Svensson
* anders/diameter/rand/OTP-13664: Use rand(3) instead of random(3)
2016-06-11Use rand(3) instead of random(3)Anders Svensson
The latter is deprecated in OTP 19.
2016-06-11Remove unnecessary no_auto_importAnders Svensson
Not difficult to avoid, and better without.
2016-06-11Redo transport config server as a gen_serverAnders Svensson
To properly handle system messages. Initially implemented in commit 5ca5fb71.
2016-05-30Close listening sockets at transport removalAnders Svensson
The transport interface documented in diameter_transport(3) is used to start/stop accepting/connecting transport processes: they're started with a function call, and told to die with their parent process. In the accepting case, both diameter_tcp and diameter_sctp start a listening process when the first accepting transport is started. However, there's no way for a listening process to find out that that it should stop listening when transport configuration is removed. Both diameter_tcp and diameter_sctp have used a timer to terminate the listening process after all existing accepting processes have died as a consequence of transport removal. The problem with this is that nothing stops a new client from connecting before this, and also that no new transport can succeed in opening the same listening port (eg. reconfiguration) until the old listener dies. This commit solves the problem by adding diameter_reg:subscribe/2, to allow callers to subscribe to messages about added/removed associations. A call to diameter:add_transport/2 results in a new child process that registers a term that a listening process subscribes to. Transport removal results in the death of the child, and the resulting notification to the listener causes the latter to close its socket and terminate. This is still an internal interface, but the subscription mechanism should probably be made external (eg. a diameter:subscribe/1 that can be used to subscribe to specified messages), so that transport modules other than diameter's own can make use of it. There is no support for soft upgrade.
2016-05-30Don't restart transport processes after transport removalAnders Svensson
A replacement accepting transport could be started after the service process received a shutdown message from diameter_config, if a connection was accepted before the transport process in question was terminated. The replacement lived on until the service needed to restart it.
2016-05-30Rename diameter_reg:del -> removeAnders Svensson
Letters are cheap.
2016-05-30Add diameter_reg:subscribe/2Anders Svensson
To allow processes to subscribe to a message when a matching association is added or removed. The intention is to use this in diameter_{tcp,sctp}, in order for listening processes to find out when transport their transport configuration has been removed.
2016-05-30Add dialyzer specs to diameter_regAnders Svensson
Last missed in commit 25bef13f.
2016-05-30Remove diameter_reg:repl/2Anders Svensson
Unused, and in the way for what's to come.
2016-05-30Remove diameter_reg bloatAnders Svensson
Unexpected messages don't happen in practice, and no_auto_import is neither necessery nor difficult to avoid.
2016-05-10Merge branch 'anders/diameter/19.0-rc1/OTP-12913'Anders Svensson
* anders/diameter/19.0-rc1/OTP-12913: vsn -> 1.12 Update appup for 19.0-rc1 Update documentation for CEA/DWA/DPA Result-Code counters
2016-05-09Merge branch 'anders/diameter/info/OTP-13508'Anders Svensson
* anders/diameter/info/OTP-13508: Add diameter:peer_find/1 Add diameter:peer_info/1
2016-05-09Merge branch 'anders/diameter/overload/OTP-13330'Anders Svensson
* anders/diameter/overload/OTP-13330: Suppress dialyzer warning Remove dead case clause Let throttling callback send a throttle message Acknowledge answers to notification pids when throttling Throttle properly with TLS Don't ask throttling callback to receive more unless needed Let a throttling callback answer a received message Let a throttling callback discard a received message Let throttling callback return a notification pid Make throttling callbacks on message reception Add diameter_tcp option throttle_cb
2016-05-09Update appup for 19.0-rc1Anders Svensson
2016-05-04Add diameter:peer_find/1Anders Svensson
To return a peer_fsm/transport pair given one of them.
2016-05-04Add diameter:peer_info/1Anders Svensson
To return information about a single peer_ref(), to avoid having to retrieve more than is needed with service_info/2.
2016-05-04Suppress dialyzer warningAnders Svensson
This one: diameter_tcp.erl:928: (call) The call diameter_tcp:throttle({'timeout',_},#transport{socket::port() | {'sslsocket',_,_},parent::pid(),module::atom(),frag::binary() | {non_neg_integer(),non_neg_integer(),binary(),[binary()]},ssl::boolean() | [any()],timeout::'infinity' | non_neg_integer(),tref::'false' | reference(),flush::boolean(),throttle_cb::'false' | fun() | maybe_improper_list(fun() | maybe_improper_list(any(),[any()]) | {atom(),atom(),[any()]},[any()]) | {atom(),atom(),[any()]},throttled::'true' | binary()}) will never return since it differs in the 1st argument from the success typing arguments: ('discard' | 'ok' | binary() | pid() | {'discard' | 'ok' | binary() | pid(),'false' | fun() | [fun() | [any()] | {atom(),atom(),[any()]}] | {atom(),atom(),[any()]}},#transport{socket::port() | {'sslsocket',_,_},parent::pid(),module::atom(),frag::binary() | {non_neg_integer(),non_neg_integer(),binary(),[binary()]},ssl::boolean() | [any()],timeout::'infinity' | non_neg_integer(),tref::'false' | reference(),flush::boolean(),throttle_cb::'false' | fun() | [fun() | [any()] | {atom(),atom(),[any()]}] | {atom(),atom(),[any()]},throttled::binary()}) It's true that the clause doesn't return, because of the throw, and that's the intention.
2016-05-03Remove dead case clauseAnders Svensson
Orphaned in commit 9298872b.
2016-03-18Let throttling callback send a throttle messageAnders Svensson
That is, don't assume that it's only diameter_tcp doing so: allow it to be received when not throttling. This lets a callback module trigger a new throttling callback itself, but it's not clear if this will be useful in practice.
2016-03-16Make peer failover more efficientAnders Svensson
Failover caused the entire request table to be scanned in search of entries with the transport process in question. With many entries (possibly as a result of the leak fixed in commit 6c9cbd96), this can lead to the service process hanging in ets:select_trap/1, with memory growth when many request processes write concurrently. Now write entries keyed on the transport pid, so that finding request processes at failover is a lookup rather than a select scanning the entire table. There is no upgrade handling in that new code doesn't consider that old code didn't write entries on the transport pid. Thus, a request whose table entries were written in old code will timeout rather than failover in new code. That is, there is a small window for failover to be missed (since request processes are short-lived), but it requires that it take place during the upgrade. As a minor aside, don't ignore failovers when sending binaries (which isn't officially supported), let prepare_retransmit callbacks deal with modifying the binary as required.
2016-03-15update copyright-yearHenrik Nord
2016-03-14Acknowledge answers to notification pids when throttlingAnders Svensson
By sending {diameter, {answer, pid()}} when an incoming answer is sent to the specified pid, instead of a discard message as previously. The latter now literally means that the message has been discarded.
2016-03-13Throttle properly with TLSAnders Svensson
In particular, let a callback decide when to receive the initial message.
2016-03-13Don't ask throttling callback to receive more unless neededAnders Svensson
TCP packets can contain more than one message, so only ask to receive another message if it hasn't already been received.
2016-03-13Let a throttling callback answer a received messageAnders Svensson
As discussed in the parent commit. This is easier said than done in practice, but there's no harm in allowing it.
2016-03-13Let a throttling callback discard a received messageAnders Svensson
This can be used as a simple form of overload protection, discarding the message before it's passed into diameter to become one more request process in a flood. Replying with 3004 would be more appropriate when the request has been directed at a specific server (the RFC's requirement) however, and possibly it should be possible for a callback to do this as well.
2016-03-13Let throttling callback return a notification pidAnders Svensson
In addition to returning ok or {timeout, Tmo}, let a throttling callback for message reception return a pid(), which is then notified if the message in question is either discarded or results in a request process. Notification is by way of messages of the form {diameter, discard | {request, pid()}} where the pid is that of a request process resulting from the received message. This allows the notification process to keep track of the maximum number of request processes a peer connection can have given rise to.
2016-03-13Make throttling callbacks on message receptionAnders Svensson
The callback is now applied to the atom 'false' when asking if another message should be received on the socket, and to a received binary message after reception. Throttling on received messages makes it possible to distinguish between requests and answers. There is no callback on outgoing messages since these don't have to go through the transport process, even if they currently do.
2016-03-13Add diameter_tcp option throttle_cbAnders Svensson
To let a callback module decide whether or to receive another message from the peer, so that backpressure can be applied when it's inappropriate. This is to let a callback protect against reading more than can be processed, which is otherwise possible since diameter_tcp otherwise always asks for more. A callback is made after each message, and can answer to continue reading or to ask again after a timeout. It's each message instead of each packet partly for simplicity, but also since this should be sufficiently fine-grained. Per packet would require some interaction with the fragment timer that flushes partial messages that haven't been completely received.
2016-03-10Merge branch 'anders/diameter/dialyzer/OTP-13400' into maint-17Erlang/OTP
* anders/diameter/dialyzer/OTP-13400: Fix dialyzer warnings
2016-03-10Merge branch 'anders/diameter/17.5.6.9/OTP-13385' into maint-17Erlang/OTP
* anders/diameter/17.5.6.9/OTP-13385: vsn -> 1.9.2.4 Update appup for 17.5.6.9