From 9a878743009952849984fd663ffb60261b9d2965 Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Tue, 15 Mar 2016 12:10:58 +0100 Subject: Make peer failover more efficient 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. --- lib/diameter/src/base/diameter_traffic.erl | 86 +++++++++++++----------------- 1 file changed, 36 insertions(+), 50 deletions(-) (limited to 'lib') diff --git a/lib/diameter/src/base/diameter_traffic.erl b/lib/diameter/src/base/diameter_traffic.erl index 5d39c08213..ba446dacbb 100644 --- a/lib/diameter/src/base/diameter_traffic.erl +++ b/lib/diameter/src/base/diameter_traffic.erl @@ -125,8 +125,16 @@ peer_up(TPid) -> %% --------------------------------------------------------------------------- peer_down(TPid) -> - ets:delete(?REQUEST_TABLE, TPid), - failover(TPid). + ets:delete_object(?REQUEST_TABLE, {TPid}), + lists:foreach(fun failover/1, ets:lookup(?REQUEST_TABLE, TPid)). +%% Note that a request process can store its request after failover +%% notifications are sent here: insert_request/2 sends the notification +%% in that case. + +%% failover/1 + +failover({_TPid, {Pid, TRef}}) -> + Pid ! {failover, TRef}. %% --------------------------------------------------------------------------- %% incr/4 @@ -1450,7 +1458,7 @@ make_request_packet(#diameter_packet{header = Hdr} = Pkt, make_request_packet(Msg, Pkt) -> Pkt#diameter_packet{msg = Msg}. -%% make_retransmit_packet/2 +%% make_retransmit_packet/1 make_retransmit_packet(#diameter_packet{msg = [#diameter_header{} = Hdr | Avps]} @@ -1704,16 +1712,13 @@ send_request(TPid, #diameter_packet{bin = Bin} = Pkt, Req, _SvcName, Timeout) when node() == node(TPid) -> Seqs = diameter_codec:sequence_numbers(Bin), TRef = erlang:start_timer(Timeout, self(), TPid), - Entry = {Seqs, Req, TRef}, + Entry = {Seqs, #request{handler = Pid} = Req, TRef}, - %% Ensure that request table is cleaned even if we receive an exit - %% signal. An alternative would be to simply trap exits, but - %% callbacks are applied in this process, and these could possibly - %% be expecting the prevailing behaviour. - Self = self(), - spawn(fun() -> diameter_lib:wait([Self]), erase_request(Entry) end), + %% Ensure that request table is cleaned even if the process is + %% killed. + spawn(fun() -> diameter_lib:wait([Pid]), delete_request(Entry) end), - store_request(Entry, TPid), + insert_request(Entry), send(TPid, Pkt), TRef; @@ -1775,6 +1780,8 @@ retransmit({TPid, Caps, App} SvcName, Timeout, []). +%% When sending a binary, it's up to prepare_retransmit to modify it +%% accordingly. retransmit({send, Msg}, Transport, @@ -1819,15 +1826,21 @@ resend_request(Pkt0, TRef = send_request(TPid, Pkt, Req, SvcName, Tmo), {TRef, Req}. -%% store_request/2 +%% insert_request/1 -store_request(T, TPid) -> - ets:insert(?REQUEST_TABLE, T), - ets:member(?REQUEST_TABLE, TPid) - orelse begin - {_Seqs, _Req, TRef} = T, - self() ! {failover, TRef} %% failover/1 may have missed - end. +insert_request({_Seqs, #request{transport = TPid}, TRef} = T) -> + ets:insert(?REQUEST_TABLE, [T, {TPid, {self(), TRef}}]), + is_peer_up(TPid) + orelse (self() ! {failover, TRef}). %% failover/1 may have missed + +%% is_peer_up/1 +%% +%% Is the entry written by peer_up/1 and deleted by peer_down/1 still +%% in the request table? + +is_peer_up(TPid) -> + Spec = [{{TPid}, [], ['$_']}], + '$end_of_table' /= ets:select(?REQUEST_TABLE, Spec, 1). %% lookup_request/2 %% @@ -1847,16 +1860,11 @@ lookup_request(Msg, TPid) -> false end. -%% erase_request/1 - -erase_request(T) -> - ets:delete_object(?REQUEST_TABLE, T). - -%% match_requests/1 +%% delete_request/1 -match_requests(TPid) -> - Pat = {'_', #request{transport = TPid, _ = '_'}, '_'}, - ets:select(?REQUEST_TABLE, [{Pat, [], ['$_']}]). +delete_request({_Seqs, #request{handler = Pid, transport = TPid}, TRef} = T) -> + Spec = [{R, [], [true]} || R <- [T, {TPid, {Pid, TRef}}]], + ets:select_delete(?REQUEST_TABLE, Spec). %% have_request/2 @@ -1865,28 +1873,6 @@ have_request(Pkt, TPid) -> Pat = {Seqs, #request{transport = TPid, _ = '_'}, '_'}, '$end_of_table' /= ets:select(?REQUEST_TABLE, [{Pat, [], ['$_']}], 1). -%% --------------------------------------------------------------------------- -%% # failover/1-2 -%% --------------------------------------------------------------------------- - -failover(TPid) - when is_pid(TPid) -> - lists:foreach(fun failover/1, match_requests(TPid)); -%% Note that a request process can store its request after failover -%% notifications are sent here: store_request/2 sends the notification -%% in that case. - -%% Failover as a consequence of peer_down/1: inform the -%% request process. -failover({_, Req, TRef}) -> - #request{handler = Pid, - packet = #diameter_packet{msg = M}} - = Req, - M /= undefined andalso (Pid ! {failover, TRef}). -%% Failover is not performed when msg = binary() since sending -%% pre-encoded binaries is only partially supported. (Mostly for -%% test.) - %% get_destination/2 get_destination(Dict, Msg) -> -- cgit v1.2.3 From ac5ac51a627dda552363be5c5268cac67ad993b2 Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Thu, 25 Aug 2016 17:48:22 +0200 Subject: Fix dictionary typo in relay example --- lib/diameter/examples/code/relay.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/diameter/examples/code/relay.erl b/lib/diameter/examples/code/relay.erl index 3846b1d161..cf4ce8848b 100644 --- a/lib/diameter/examples/code/relay.erl +++ b/lib/diameter/examples/code/relay.erl @@ -53,7 +53,7 @@ {'Auth-Application-Id', [16#FFFFFFFF]}, {string_decode, false}, {application, [{alias, relay}, - {dictionary, diameter_relay}, + {dictionary, diameter_gen_relay}, {module, relay_cb}]}]). %% start/1 -- cgit v1.2.3 From d41cfa87e43725953b4eb3efca31413708b71ed4 Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Thu, 25 Aug 2016 17:51:51 +0200 Subject: Fix dictionary function typo 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. --- lib/diameter/src/base/diameter_traffic.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/diameter/src/base/diameter_traffic.erl b/lib/diameter/src/base/diameter_traffic.erl index 2112941d5e..f22ca737a9 100644 --- a/lib/diameter/src/base/diameter_traffic.erl +++ b/lib/diameter/src/base/diameter_traffic.erl @@ -911,7 +911,7 @@ failed(Rec, FailedAvp, Dict) -> {'Failed-AVP', [FailedAvp]} catch error: _ -> - Avps = Dict:'get-'('AVP', Rec), + Avps = Dict:'#get-'('AVP', Rec), A = #diameter_avp{name = 'Failed-AVP', value = FailedAvp}, {'AVP', [A|Avps]} -- cgit v1.2.3 From 4c99d6898b83d2b9881642f3a2c4a726d936b2f5 Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Thu, 25 Aug 2016 17:58:37 +0200 Subject: Remove copyright from generated dictionary modules The copyright was a historical remnant of diameter's roots prior to its inclusion in OTP. Thanks to Anatolie Golovco. --- lib/diameter/src/compiler/diameter_codegen.erl | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/diameter/src/compiler/diameter_codegen.erl b/lib/diameter/src/compiler/diameter_codegen.erl index cdaa9aa7f9..4007d6b7b1 100644 --- a/lib/diameter/src/compiler/diameter_codegen.erl +++ b/lib/diameter/src/compiler/diameter_codegen.erl @@ -790,20 +790,7 @@ header() -> ("%% -------------------------------------------------------------------\n" "%% This is a generated file.\n" "%% -------------------------------------------------------------------\n" - "\n" - "%%\n" - "%% Copyright (c) Ericsson AB. All rights reserved.\n" - "%%\n" - "%% The information in this document is the property of Ericsson.\n" - "%%\n" - "%% Except as specifically authorized in writing by Ericsson, the\n" - "%% receiver of this document shall keep the information contained\n" - "%% herein confidential and shall protect the same in whole or in\n" - "%% part from disclosure and dissemination to third parties.\n" - "%%\n" - "%% Disclosure and disseminations to the receivers employees shall\n" - "%% only be made on a strict need to know basis.\n" - "%%\n\n"). + "\n"). hrl_header(Name) -> header() ++ "-hrl_name('" ++ ?S(Name) ++ ".hrl').\n". -- cgit v1.2.3 From 2afd1fe5fca3082193ff555fce8c62a31a5ea83f Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Sat, 6 Aug 2016 00:55:20 +0200 Subject: Close listening sockets at service death 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. --- lib/diameter/src/transport/diameter_sctp.erl | 76 ++++++++++++-------- lib/diameter/src/transport/diameter_tcp.erl | 104 ++++++++++++++++----------- 2 files changed, 108 insertions(+), 72 deletions(-) (limited to 'lib') diff --git a/lib/diameter/src/transport/diameter_sctp.erl b/lib/diameter/src/transport/diameter_sctp.erl index 4a005b853d..f48e4347ee 100644 --- a/lib/diameter/src/transport/diameter_sctp.erl +++ b/lib/diameter/src/transport/diameter_sctp.erl @@ -98,7 +98,7 @@ -record(listener, {ref :: reference(), socket :: gen_sctp:sctp_socket(), - count = 0 :: uint(), %% attached transport processes + service = false :: false | pid(), %% service process pending = {0, queue:new()}, accept :: [match()]}). %% Field pending implements two queues: the first of transport-to-be @@ -129,11 +129,14 @@ -> {ok, pid(), [inet:ip_address()]} when Ref :: diameter:transport_ref(). -start(T, #diameter_service{capabilities = Caps}, Opts) +start(T, Svc, Opts) when is_list(Opts) -> + #diameter_service{capabilities = Caps, + pid = SPid} + = Svc, diameter_sctp_sup:start(), %% start supervisors on demand Addrs = Caps#diameter_caps.host_ip_address, - s(T, Addrs, lists:map(fun ip/1, Opts)). + s(T, Addrs, SPid, lists:map(fun ip/1, Opts)). ip({ifaddr, A}) -> {ip, A}; @@ -144,18 +147,22 @@ ip(T) -> %% when there is not yet an association to assign it, or at comm_up on %% a new association in which case the call retrieves a transport from %% the pending queue. -s({accept, Ref} = A, Addrs, Opts) -> - {LPid, LAs} = listener(Ref, {Opts, Addrs}), - try gen_server:call(LPid, {A, self()}, infinity) of - {ok, TPid} -> {ok, TPid, LAs} +s({accept, Ref} = A, Addrs, SPid, Opts) -> + {ok, LPid, LAs} = listener(Ref, {Opts, Addrs}), + try gen_server:call(LPid, {A, self(), SPid}, infinity) of + {ok, TPid} -> + {ok, TPid, LAs}; + No -> + {error, No} catch - exit: Reason -> {error, Reason} + exit: Reason -> + {error, Reason} end; %% This implementation is due to there being no accept call in %% gen_sctp in order to be able to accept a new association only %% *after* an accepting transport has been spawned. -s({connect = C, Ref}, Addrs, Opts) -> +s({connect = C, Ref}, Addrs, _SPid, Opts) -> diameter_sctp_sup:start_child({C, self(), Opts, Addrs, Ref}). %% start_link/1 @@ -281,24 +288,23 @@ i({K, Ref}, #transport{mode = {accept, _}} = S) -> %% Accepting processes can be started concurrently: ensure only one %% listener is started. -listener(LRef, T) -> - diameter_sync:call({?MODULE, listener, LRef}, - {?MODULE, listener, [{LRef, T}]}, +listener(Ref, T) -> + diameter_sync:call({?MODULE, listener, Ref}, + {?MODULE, listener, [{Ref, T}]}, infinity, infinity). -listener({LRef, T}) -> - l(diameter_reg:match({?MODULE, listener, {LRef, '_'}}), LRef, T). +listener({Ref, T}) -> + l(diameter_reg:match({?MODULE, listener, {Ref, '_'}}), Ref, T). %% Existing listening process ... l([{{?MODULE, listener, {_, AS}}, LPid}], _, _) -> - {LAs, _Sock} = AS, - {LPid, LAs}; + {LAs, _Sock} = AS, + {ok, LPid, LAs}; %% ... or not. -l([], LRef, T) -> - {ok, LPid, LAs} = diameter_sctp_sup:start_child({listen, LRef, T}), - {LPid, LAs}. +l([], Ref, T) -> + diameter_sctp_sup:start_child({listen, Ref, T}). %% open/3 @@ -364,11 +370,17 @@ type(T) -> %% # handle_call/3 %% --------------------------------------------------------------------------- -handle_call({{accept, Ref}, Pid}, _, #listener{ref = Ref, - count = K} - = S) -> +handle_call({{accept, Ref}, Pid}, _, #listener{ref = Ref} = S) -> {TPid, NewS} = accept(Ref, Pid, S), - {reply, {ok, TPid}, NewS#listener{count = K+1}}; + {reply, {ok, TPid}, NewS}; + +handle_call({{accept, _} = T, Pid, SPid}, From, #listener{service = P} = S) -> + handle_call({T, Pid}, From, if not is_pid(P), is_pid(SPid) -> + monitor(process, SPid), + S#listener{service = SPid}; + true -> + S + end); handle_call(_, _, State) -> {reply, nok, State}. @@ -441,6 +453,13 @@ l({sctp, Sock, _RA, _RP, Data} = T, #listener{socket = Sock, setopts(Sock), NewS; +%% Service process has died. +l({'DOWN', _, process, Pid, _} = T, #listener{service = Pid, + socket = Sock}) -> + gen_sctp:close(Sock), + x(T); + +%% Accepting process has died. l({'DOWN', _MRef, process, TPid, _}, #listener{pending = {_,Q}} = S) -> down(queue:member(TPid, Q), TPid, S); @@ -454,20 +473,17 @@ l({transport, remove, _} = T, #listener{socket = Sock}) -> %% Accepting transport has died. %% One that's waiting for transport start in the pending queue ... -down(true, TPid, #listener{pending = {N,Q}, - count = K} - = S) -> +down(true, TPid, #listener{pending = {N,Q}} = S) -> NQ = queue:filter(fun(P) -> P /= TPid end, Q), if N < 0 -> %% awaiting an association ... - S#listener{count = K-1, - pending = {N+1, NQ}}; + S#listener{pending = {N+1, NQ}}; true -> %% ... or one has been assigned S#listener{pending = {N-1, NQ}} end; %% ... or one that's already attached. -down(false, _TPid, #listener{count = K} = S) -> - S#listener{count = K-1}. +down(false, _TPid, S) -> + S. %% t/2 %% diff --git a/lib/diameter/src/transport/diameter_tcp.erl b/lib/diameter/src/transport/diameter_tcp.erl index 546c2cfa5e..44abc5c3b4 100644 --- a/lib/diameter/src/transport/diameter_tcp.erl +++ b/lib/diameter/src/transport/diameter_tcp.erl @@ -71,11 +71,8 @@ %% a process owning the listening port. %% Listener process state. --record(listener, {socket :: inet:socket(), - count = 1 :: non_neg_integer()}). %% accepting processes -%% The count of accepting processes was previously used to terminate -%% the listening process, but diameter_reg:subscribe/2 is now used for -%% this. Leave the the count for trace purposes. +-record(listener, {socket :: inet:socket(), + service = false :: false | pid()}). %% service process %% Monitor process state. -record(monitor, @@ -138,11 +135,15 @@ | {ok, pid()} when Ref :: diameter:transport_ref(). -start({T, Ref}, #diameter_service{capabilities = Caps}, Opts) -> +start({T, Ref}, Svc, Opts) -> + #diameter_service{capabilities = Caps, + pid = SPid} + = Svc, + diameter_tcp_sup:start(), %% start tcp supervisors on demand {Mod, Rest} = split(Opts), Addrs = Caps#diameter_caps.host_ip_address, - Arg = {T, Ref, Mod, self(), Rest, Addrs}, + Arg = {T, Ref, Mod, self(), Rest, Addrs, SPid}, diameter_tcp_sup:start_child(Arg). split([{module, M} | Opts]) -> @@ -196,7 +197,7 @@ init(T) -> %% i/1 %% A transport process. -i({T, Ref, Mod, Pid, Opts, Addrs}) +i({T, Ref, Mod, Pid, Opts, Addrs, SPid}) when T == accept; T == connect -> monitor(process, Pid), @@ -214,7 +215,7 @@ i({T, Ref, Mod, Pid, Opts, Addrs}) ?DEFAULT_FRAGMENT_TIMEOUT), ?IS_TIMEOUT(Tmo) orelse ?ERROR({fragment_timer, Tmo}), Throttle = proplists:get_value(throttle_cb, OwnOpts, false), - Sock = init(T, Ref, Mod, Pid, SslOpts, Rest, Addrs), + Sock = init(T, Ref, Mod, Pid, SslOpts, Rest, Addrs, SPid), MPid ! {stop, self()}, %% tell the monitor to die M = if SslOpts -> ssl; true -> Mod end, putr(?REF_KEY, Ref), @@ -228,6 +229,11 @@ i({T, Ref, Mod, Pid, Opts, Addrs}) %% Put the reference in the process dictionary since we now use it %% advertise the ssl socket after TLS upgrade. +i({T, _Ref, _Mod, _Pid, _Opts, _Addrs} = Arg) %% from old code + when T == accept; + T == connect -> + i(erlang:append_element(Arg, _SPid = false)); + %% A monitor process to kill the transport if the parent dies. i(#monitor{parent = Pid, transport = TPid} = S) -> proc_lib:init_ack({ok, self()}), @@ -240,16 +246,18 @@ i(#monitor{parent = Pid, transport = TPid} = S) -> %% death. However, a link can be unlinked and this is exactly what %% gen_tcp seems to so. Links should be left to supervisors. -i({listen, LRef, APid, {Mod, Opts, Addrs}}) -> - [_] = diameter_config:subscribe(LRef, transport), %% assert existence +i({listen = L, Ref, _APid, T}) -> %% from old code + i({L, Ref, T}); + +i({listen, Ref, {Mod, Opts, Addrs}}) -> + [_] = diameter_config:subscribe(Ref, transport), %% assert existence {[LA, LP], Rest} = proplists:split(Opts, [ip, port]), LAddrOpt = get_addr(LA, Addrs), LPort = get_port(LP), {ok, LSock} = Mod:listen(LPort, gen_opts(LAddrOpt, Rest)), LAddr = laddr(LAddrOpt, Mod, LSock), - true = diameter_reg:add_new({?MODULE, listener, {LRef, {LAddr, LSock}}}), + true = diameter_reg:add_new({?MODULE, listener, {Ref, {LAddr, LSock}}}), proc_lib:init_ack({ok, self(), {LAddr, LSock}}), - monitor(process, APid), #listener{socket = LSock}. laddr([], Mod, Sock) -> @@ -268,21 +276,22 @@ ssl_opts([{ssl_options, Opts}]) ssl_opts(T) -> ?ERROR({ssl_options, T}). -%% init/7 +%% init/8 %% Establish a TLS connection before capabilities exchange ... -init(Type, Ref, Mod, Pid, true, Opts, Addrs) -> - init(Type, Ref, ssl, Pid, [{cb_info, ?TCP_CB(Mod)} | Opts], Addrs); +init(Type, Ref, Mod, Pid, true, Opts, Addrs, SPid) -> + init(Type, Ref, ssl, Pid, [{cb_info, ?TCP_CB(Mod)} | Opts], Addrs, SPid); %% ... or not. -init(Type, Ref, Mod, Pid, _, Opts, Addrs) -> - init(Type, Ref, Mod, Pid, Opts, Addrs). +init(Type, Ref, Mod, Pid, _, Opts, Addrs, SPid) -> + init(Type, Ref, Mod, Pid, Opts, Addrs, SPid). -%% init/6 +%% init/7 -init(accept = T, Ref, Mod, Pid, Opts, Addrs) -> +init(accept = T, Ref, Mod, Pid, Opts, Addrs, SPid) -> {[Matches], Rest} = proplists:split(Opts, [accept]), - {LAddr, LSock} = listener(Ref, {Mod, Rest, Addrs}), + {ok, LPid, {LAddr, LSock}} = listener(Ref, {Mod, Rest, Addrs}), + ok = gen_server:call(LPid, {accept, SPid}, infinity), proc_lib:init_ack({ok, self(), [LAddr]}), Sock = ok(accept(Mod, LSock)), ok = accept_peer(Mod, Sock, accept(Matches)), @@ -290,7 +299,7 @@ init(accept = T, Ref, Mod, Pid, Opts, Addrs) -> diameter_peer:up(Pid), Sock; -init(connect = T, Ref, Mod, Pid, Opts, Addrs) -> +init(connect = T, Ref, Mod, Pid, Opts, Addrs, _SPid) -> {[LA, RA, RP], Rest} = proplists:split(Opts, [ip, raddr, rport]), LAddrOpt = get_addr(LA, Addrs), RAddr = get_addr(RA), @@ -344,24 +353,26 @@ accept(Opts) -> %% Accepting processes can be started concurrently: ensure only one %% listener is started. -listener(LRef, T) -> - diameter_sync:call({?MODULE, listener, LRef}, - {?MODULE, listener, [{LRef, T, self()}]}, +listener(Ref, T) -> + diameter_sync:call({?MODULE, listener, Ref}, + {?MODULE, listener, [{Ref, T, self()}]}, infinity, infinity). -listener({LRef, T, TPid}) -> - l(diameter_reg:match({?MODULE, listener, {LRef, '_'}}), LRef, T, TPid). +%% listener/1 + +listener({Ref, T, _TPid}) -> + l(diameter_reg:match({?MODULE, listener, {Ref, '_'}}), Ref, T). + +%% l/3 %% Existing listening process ... -l([{{?MODULE, listener, {_, AS}}, LPid}], _, _, TPid) -> - LPid ! {accept, TPid}, - AS; +l([{{?MODULE, listener, {_, AS}}, LPid}], _, _) -> + {ok, LPid, AS}; %% ... or not. -l([], LRef, T, TPid) -> - {ok, _, AS} = diameter_tcp_sup:start_child({listen, LRef, TPid, T}), - AS. +l([], Ref, T) -> + diameter_tcp_sup:start_child({listen, Ref, T}). %% get_addr/1 @@ -440,6 +451,14 @@ portnr(Sock) -> %% # handle_call/3 %% --------------------------------------------------------------------------- +handle_call({accept, SPid}, _From, #listener{service = P} = S) -> + {reply, ok, if not is_pid(P), is_pid(SPid) -> + monitor(process, SPid), + S#listener{service = SPid}; + true -> + S + end}; + handle_call(_, _, State) -> {reply, nok, State}. @@ -507,19 +526,20 @@ m({'DOWN', _, process, Pid, _}, #monitor{parent = Pid, %% %% Transition listener state. -%% An accepting transport is attaching. -l({accept, TPid}, #listener{count = N} = S) -> - monitor(process, TPid), - S#listener{count = N+1}; - -%% Accepting process has died. -l({'DOWN', _, process, _, _}, #listener{count = N} = S) -> - S#listener{count = N-1}; +%% Service process has died. +l({'DOWN', _, process, Pid, _} = T, #listener{service = Pid, + socket = Sock}) -> + gen_tcp:close(Sock), + x(T); %% Transport has been removed. l({transport, remove, _} = T, #listener{socket = Sock}) -> gen_tcp:close(Sock), - x(T). + x(T); + +%% Possibly death of an accepting process monitored in old code. +l(_, S) -> + S. %% t/2 %% -- cgit v1.2.3 From ea1c01bd1be507de3762f4f088f8ca8664f3950b Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Thu, 25 Aug 2016 18:28:43 +0200 Subject: Don't run traffic tests in parallel when {string_decode, true} Since the large strings copied between processes cause testcases to fail randomly. Option string_decode was added in commit 1590920c. --- lib/diameter/test/diameter_traffic_SUITE.erl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl index 6f3a4801ee..4c82d4dee2 100644 --- a/lib/diameter/test/diameter_traffic_SUITE.erl +++ b/lib/diameter/test/diameter_traffic_SUITE.erl @@ -248,17 +248,14 @@ all() -> groups() -> Ts = tc(), Sctp = ?util:have_sctp(), - [{?util:name([R,D,A,C]), [parallel], Ts} || R <- ?ENCODINGS, - D <- ?RFCS, - A <- ?ENCODINGS, - C <- ?CONTAINERS] + [{B, [P], Ts} || {B,P} <- [{true, shuffle}, {false, parallel}]] ++ [{?util:name([T,R,D,A,C,SD,CD]), [], [start_services, add_transports, result_codes, - {group, ?util:name([R,D,A,C])}, + {group, SD orelse CD}, remove_transports, stop_services]} || T <- ?TRANSPORTS, -- cgit v1.2.3 From 7fb4bf84556c516da4c5c7203727e4b6a8bb7bda Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Fri, 26 Aug 2016 00:40:22 +0200 Subject: Remove documentation overkill "Defaults to X" isn't clarified by "if unspecified". --- lib/diameter/doc/src/diameter.xml | 17 ++++++++--------- lib/diameter/doc/src/diameter_dict.xml | 2 +- lib/diameter/doc/src/diameter_tcp.xml | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/diameter/doc/src/diameter.xml b/lib/diameter/doc/src/diameter.xml index d68a78ed6d..f9f3839094 100644 --- a/lib/diameter/doc/src/diameter.xml +++ b/lib/diameter/doc/src/diameter.xml @@ -159,8 +159,7 @@ Has one the following types.

Unique identifier for the application in the scope of the service. -Defaults to the value of the dictionary option if -unspecified.

+Defaults to the value of the dictionary option.

{dictionary, atom()} @@ -187,7 +186,7 @@ Initial callback state. The prevailing state is passed to some &man_app; callbacks, which can then return a new state. -Defaults to the value of the alias option if unspecified.

+Defaults to the value of the alias option.

{call_mutates_state, true|false} @@ -195,7 +194,7 @@ Defaults to the value of the alias option if unspecified.

Whether or not the &app_pick_peer; application callback can modify the application state. -Defaults to false if unspecified.

+Defaults to false.

@@ -228,7 +227,7 @@ question is as if a callback had taken place and returned {error, failure}.

-Defaults to discard if unspecified.

+Defaults to discard.

{request_errors, answer_3xxx|answer|callback} @@ -249,7 +248,7 @@ place and its return value determines the answer sent to the peer, if any.

-Defaults to answer_3xxx if unspecified.

+Defaults to answer_3xxx.

@@ -1328,7 +1327,7 @@ Defaults to the list configured on the service if not specified.

Term passed as the third argument to the &transport_start; function of the relevant &transport_module; in order to start a transport process. -Defaults to the empty list if unspecified.

+Defaults to the empty list.

The 3-tuple form additionally specifies an interval, in milliseconds, @@ -1354,7 +1353,7 @@ To listen on both SCTP and TCP, define one transport for each.

Module implementing a transport process as defined in &man_transport;. -Defaults to diameter_tcp if unspecified.

+Defaults to diameter_tcp.

Multiple transport_module and &transport_config; @@ -1412,7 +1411,7 @@ the callback.

An integer value must be at least 6000 as required by RFC 3539. -Defaults to 30000 if unspecified.

+Defaults to 30000.

diff --git a/lib/diameter/doc/src/diameter_dict.xml b/lib/diameter/doc/src/diameter_dict.xml index ae40f99aee..c924bd7fc3 100644 --- a/lib/diameter/doc/src/diameter_dict.xml +++ b/lib/diameter/doc/src/diameter_dict.xml @@ -153,7 +153,7 @@ Example:

Defines the name of the generated dictionary module. Can occur at most once and defaults to the name of the dictionary file -minus any extension if unspecified. +minus any extension. The section has empty content.

diff --git a/lib/diameter/doc/src/diameter_tcp.xml b/lib/diameter/doc/src/diameter_tcp.xml index 00ccc39c15..6ca280c52b 100644 --- a/lib/diameter/doc/src/diameter_tcp.xml +++ b/lib/diameter/doc/src/diameter_tcp.xml @@ -150,7 +150,7 @@ Options binary, packet and active cannot be specified. Also, option port can be specified for a listening transport to specify the local listening port, the default being the standardized -3868 if unspecified. +3868. Note that the option ip specifies the local address.

-- cgit v1.2.3 From a2f9fa00d184d89619bfd61313387a943f9dd19e Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Fri, 26 Aug 2016 08:15:26 +0200 Subject: Fix xmllint errors in documentation --- lib/diameter/doc/src/diameter.xml | 138 ++++++++++++++-------------- lib/diameter/doc/src/diameter_app.xml | 39 +++----- lib/diameter/doc/src/diameter_codec.xml | 56 +++++------ lib/diameter/doc/src/diameter_dict.xml | 67 ++++++-------- lib/diameter/doc/src/diameter_examples.xml | 1 - lib/diameter/doc/src/diameter_transport.xml | 9 +- lib/diameter/doc/src/diameterc.xml | 6 +- 7 files changed, 143 insertions(+), 173 deletions(-) (limited to 'lib') diff --git a/lib/diameter/doc/src/diameter.xml b/lib/diameter/doc/src/diameter.xml index f9f3839094..72181a42b0 100644 --- a/lib/diameter/doc/src/diameter.xml +++ b/lib/diameter/doc/src/diameter.xml @@ -94,12 +94,12 @@ in this module.

-Address() -DiameterIdentity() -Grouped() -OctetString() -Time() -Unsigned32() +Address() +DiameterIdentity() +Grouped() +OctetString() +Time() +Unsigned32() UTF8String()

@@ -338,8 +338,8 @@ Has one of the following types.

-{'Origin-Host', &dict_DiameterIdentity;} -{'Origin-Realm', &dict_DiameterIdentity;} +{'Origin-Host', &dict_DiameterIdentity;} +{'Origin-Realm', &dict_DiameterIdentity;} {'Host-IP-Address', [&dict_Address;]}

@@ -351,8 +351,8 @@ question communicates an address list as described in &man_transport;

-{'Vendor-Id', &dict_Unsigned32;} -{'Product-Name', &dict_UTF8String;} +{'Vendor-Id', &dict_Unsigned32;} +{'Product-Name', &dict_UTF8String;} {'Origin-State-Id', &dict_Unsigned32;}

@@ -365,8 +365,8 @@ can be used as to retrieve a value that is computed when the diameter application is started.

-{'Supported-Vendor-Id', [&dict_Unsigned32;]} -{'Auth-Application-Id', [&dict_Unsigned32;]} +{'Supported-Vendor-Id', [&dict_Unsigned32;]} +{'Auth-Application-Id', [&dict_Unsigned32;]} {'Inband-Security-Id', [&dict_Unsigned32;]}

@@ -376,9 +376,9 @@ If 1 (TLS) is specified then TLS is selected if the CER/CEA received from the peer offers it.

-{'Acct-Application-Id', [&dict_Unsigned32;]} -{'Vendor-Specific-Application-Id', [&dict_Grouped;]} -{'Firmware-Revision', &dict_Unsigned32;} +{'Acct-Application-Id', [&dict_Unsigned32;]} +{'Vendor-Specific-Application-Id', [&dict_Grouped;]} +{'Firmware-Revision', &dict_Unsigned32;}
@@ -566,9 +566,8 @@ Can have one of the following types.

-start +start stop -

The service is being started or stopped. @@ -577,8 +576,8 @@ No event follows a stop event, and this event implies the termination of all transport processes.

-{up, Ref, Peer, Config, Pkt} -{up, Ref, Peer, Config} +{up, Ref, Peer, Config, Pkt} +{up, Ref, Peer, Config} {down, Ref, Peer, Config}
@@ -787,8 +786,8 @@ be matched by corresponding &capability; configuration, of
 
 
 
-
-{incoming_maxlen, 0..16777215}
+
+{incoming_maxlen, 0..16777215}
 
 

Bound on the expected size of incoming Diameter messages. @@ -916,8 +915,8 @@ Options monitor and link are ignored.

Defaults to the empty list.

- -{strict_mbit, boolean()} + +{strict_mbit, boolean()}

Whether or not to regard an AVP setting the M-bit as erroneous when @@ -934,7 +933,7 @@ Defaults to true.

RFC 6733 is unclear about the semantics of the M-bit. One the one hand, the CCF specification in section 3.2 documents AVP -in a command grammar as meaning any arbitrary AVP; on the +in a command grammar as meaning any arbitrary AVP; on the other hand, 1.3.4 states that AVPs setting the M-bit cannot be added to an existing command: the modified command must instead be placed in a new Diameter application.

@@ -944,7 +943,7 @@ allowing arbitrary AVPs setting the M-bit in a command makes its interpretation implementation-dependent, since there's no guarantee that all implementations will understand the same set of arbitrary AVPs in the context of a given command. -However, interpreting AVP in a command grammar as any +However, interpreting AVP in a command grammar as any AVP, regardless of M-bit, renders 1.3.4 meaningless, since the receiver can simply ignore any AVP it thinks isn't relevant, regardless of the sender's intent.

@@ -959,8 +958,8 @@ occur in the message in question.

- -{string_decode, boolean()} + +{string_decode, boolean()}

Whether or not to decode AVPs of type &dict_OctetString; and its @@ -1030,8 +1029,9 @@ Option passed to &add_transport;. Has one of the following types.

- -{applications, [&application_alias;]} + + +{applications, [&application_alias;]}

Diameter applications to which the transport should be restricted. @@ -1049,8 +1049,8 @@ implies having to set matching *-Application-Id AVPs in a - -{capabilities, [&capability;]} + +{capabilities, [&capability;]}

AVPs used to construct outgoing CER/CEA messages. @@ -1063,8 +1063,8 @@ may be particularly appropriate for Inband-Security-Id, in case TLS is desired over TCP as implemented by &man_tcp;.

- -{capabilities_cb, &evaluable;} + +{capabilities_cb, &evaluable;}

Callback invoked upon reception of CER/CEA during capabilities @@ -1111,8 +1111,8 @@ case the corresponding callbacks are applied until either all return ok or one does not.

- -{capx_timeout, &dict_Unsigned32;} + +{capx_timeout, &dict_Unsigned32;}

Number of milliseconds after which a transport process having an @@ -1126,8 +1126,8 @@ For a listening transport, the peer determines the timing.

Defaults to 10000.

- -{connect_timer, Tc} + +{connect_timer, Tc}
 Tc = &dict_Unsigned32;
@@ -1157,9 +1157,8 @@ Defaults to 30000 for a connecting transport and 60000 for a listening
 transport.

- -{disconnect_cb, &evaluable;} - + +{disconnect_cb, &evaluable;}

Callback invoked prior to terminating the transport process of a @@ -1235,8 +1234,8 @@ configured them.

Defaults to a single callback returning dpr.

- -{dpa_timeout, &dict_Unsigned32;} + +{dpa_timeout, &dict_Unsigned32;}

Number of milliseconds after which a transport connection is @@ -1246,8 +1245,8 @@ terminated following an outgoing DPR if DPA is not received.

Defaults to 1000.

- -{dpr_timeout, &dict_Unsigned32;} + +{dpr_timeout, &dict_Unsigned32;}

Number of milliseconds after which a transport connection is @@ -1258,8 +1257,8 @@ connection.

Defaults to 5000.

- -{length_errors, exit|handle|discard} + +{length_errors, exit|handle|discard}

How to deal with errors in the Message Length field of the @@ -1307,8 +1306,8 @@ the same peer.

- -{spawn_opt, [term()]} + +{spawn_opt, [term()]}

Options passed to &spawn_opt; when spawning a process for an @@ -1319,8 +1318,8 @@ Options monitor and link are ignored.

Defaults to the list configured on the service if not specified.

- -{transport_config, term()} + +{transport_config, term()} {transport_config, term(), &dict_Unsigned32; | infinity}

@@ -1348,8 +1347,8 @@ request a connection with one peer over SCTP or another To listen on both SCTP and TCP, define one transport for each.

- -{transport_module, atom()} + +{transport_module, atom()}

Module implementing a transport process as defined in &man_transport;. @@ -1368,8 +1367,9 @@ modules in order until one establishes a connection within the corresponding timeout (see below) or all fail.

- -{watchdog_config, [{okay|suspect, non_neg_integer()}]} + +{watchdog_config, + [{okay|suspect, non_neg_integer()}]}

Configuration that alters the behaviour of the watchdog @@ -1392,8 +1392,8 @@ misbehaving nodes during test.

- -{watchdog_timer, TwInit} + +{watchdog_timer, TwInit}
 TwInit = &dict_Unsigned32;
@@ -1421,10 +1421,10 @@ Unrecognized options are silently ignored but are returned unmodified
 by &service_info; and can be referred to
 in predicate functions passed to &remove_transport;.

- -transport_ref() = reference() + +transport_ref() = reference()

Reference returned by &add_transport; that @@ -1681,17 +1681,17 @@ returned.

-'Origin-Host' -'Origin-Realm' -'Vendor-Id' -'Product-Name' -'Origin-State-Id' -'Host-IP-Address' -'Supported-Vendor' -'Auth-Application-Id' -'Inband-Security-Id' -'Acct-Application-Id' -'Vendor-Specific-Application-Id' +'Origin-Host' +'Origin-Realm' +'Vendor-Id' +'Product-Name' +'Origin-State-Id' +'Host-IP-Address' +'Supported-Vendor' +'Auth-Application-Id' +'Inband-Security-Id' +'Acct-Application-Id' +'Vendor-Specific-Application-Id' 'Firmware-Revision'

diff --git a/lib/diameter/doc/src/diameter_app.xml b/lib/diameter/doc/src/diameter_app.xml index 973b6eb732..dfcd00975b 100644 --- a/lib/diameter/doc/src/diameter_app.xml +++ b/lib/diameter/doc/src/diameter_app.xml @@ -90,17 +90,14 @@ is called in response to an incoming Diameter request message.

- - -

-The arities given for the the callback functions here assume no extra -arguments. +The arities for the the callback functions here assume no extra arguments. All functions will also be passed any extra arguments configured with the callback module itself when calling &mod_start_service; and, for the call-specific callbacks, any extra arguments passed to &mod_call;.

-
+ + @@ -110,9 +107,8 @@ and, for the call-specific callbacks, any extra arguments passed to - - -capabilities() = #diameter_caps{} + +capabilities() = #diameter_caps{}

A record containing the identities of @@ -126,9 +122,8 @@ Optional or possibly multiple values are encoded as lists of values, mandatory values as the bare value.

- - -message() = &codec_message; + +message() = &codec_message;

The representation of a Diameter message as passed to @@ -136,9 +131,8 @@ The representation of a Diameter message as passed to - - -packet() = &codec_packet; + +packet() = &codec_packet;

A container for incoming and outgoing Diameter messages that's passed @@ -146,25 +140,22 @@ through encode/decode and transport. Fields should not be set in return values except as documented.

- - -peer_ref() = term() + +peer_ref() = term()

A term identifying a transport connection with a Diameter peer.

- - -peer() = {&peer_ref;, &capabilities;} + +peer() = {&peer_ref;, &capabilities;}

A tuple representing a Diameter peer connection.

- - -state() = term() + +state() = term()

The state maintained by the application callback functions diff --git a/lib/diameter/doc/src/diameter_codec.xml b/lib/diameter/doc/src/diameter_codec.xml index a0313e2877..91e96058dd 100644 --- a/lib/diameter/doc/src/diameter_codec.xml +++ b/lib/diameter/doc/src/diameter_codec.xml @@ -88,10 +88,9 @@ files resulting from dictionary file compilation.

- - -uint8()  = 0..255 -uint24() = 0..16777215 + +uint8()  = 0..255 +uint24() = 0..16777215 uint32() = 0..4294967295

@@ -99,9 +98,8 @@ files resulting from dictionary file compilation.

headers.

- - -avp() = #diameter_avp{} + +avp() = #diameter_avp{}

The application-neutral representation of an AVP. @@ -116,9 +114,9 @@ Fields have the following types.

-code = uint32() -is_mandatory = boolean() -need_encryption = boolean() +code = uint32() +is_mandatory = boolean() +need_encryption = boolean() vendor_id = uint32() | undefined

@@ -167,9 +165,8 @@ Possible types are undefined and the Diameter types: - - -dictionary() = module() + +dictionary() = module()

@@ -179,9 +176,8 @@ The interface provided by a dictionary module is an implementation detail that may change.

- - -header() = #diameter_header{} + +header() = #diameter_header{}

The record representation of the Diameter header. @@ -204,11 +200,11 @@ Fields have the following types.

-version = uint8() -length = uint24() -cmd_code = uint24() -application_id = uint32() -hop_by_hop_id = uint32() +version = uint8() +length = uint24() +cmd_code = uint24() +application_id = uint32() +hop_by_hop_id = uint32() end_to_end_id = uint32()

@@ -217,9 +213,9 @@ Hop-by-Hop Identifier and End-to-End Identifier fields of the Diameter header.

-is_request = boolean() -is_proxiable = boolean() -is_error = boolean() +is_request = boolean() +is_proxiable = boolean() +is_error = boolean() is_retransmitted = boolean()

@@ -232,9 +228,8 @@ header.

- - -message() = record() | list() + +message() = record() | list()

The representation of a Diameter message as passed to @@ -257,9 +252,8 @@ question: messages are sent exactly as specified.

- - -packet() = #diameter_packet{} + +packet() = #diameter_packet{}

A container for incoming and outgoing Diameter messages. @@ -296,7 +290,7 @@ corresponding values.

-A record-valued msg field does not imply an absence of +A record-valued msg field does not imply an absence of decode errors. The errors field should also be examined.

diff --git a/lib/diameter/doc/src/diameter_dict.xml b/lib/diameter/doc/src/diameter_dict.xml index c924bd7fc3..9584d682c2 100644 --- a/lib/diameter/doc/src/diameter_dict.xml +++ b/lib/diameter/doc/src/diameter_dict.xml @@ -1,5 +1,5 @@ -FILE FORMAT'> - - -@id Number + +@id Number

Defines the integer Number as the Diameter Application Id of the @@ -146,9 +145,8 @@ Example:

- - -@name Mod + +@name Mod

Defines the name of the generated dictionary module. @@ -169,9 +167,8 @@ Example:

- - -@prefix Name + +@prefix Name

Defines Name as the prefix to be added to record and constant names @@ -194,9 +191,8 @@ Example:

- - -@vendor Number Name + +@vendor Number Name

Defines the integer Number as the the default Vendor-Id of AVPs for @@ -216,9 +212,8 @@ Example:

- - -@avp_vendor_id Number + +@avp_vendor_id Number

Defines the integer Number as the Vendor-Id of the AVPs listed in the @@ -238,9 +233,8 @@ Region-Set - - -@inherits Mod + +@inherits Mod

Defines the name of a dictionary module containing AVP @@ -274,9 +268,8 @@ Example:

- - -@avp_types + +@avp_types

Defines the name, code, type and flags of individual AVPs. @@ -308,9 +301,8 @@ The P flag has been deprecated by &the_rfc;.

- - -@custom_types Mod + +@custom_types Mod

Specifies AVPs for which module Mod provides encode/decode functions. @@ -331,9 +323,8 @@ Framed-IP-Address

- - -@codecs Mod + +@codecs Mod

Like @custom_types but requires the specified module to export @@ -350,9 +341,8 @@ Framed-IP-Address

- - -@messages + +@messages

Defines the messages of the application. @@ -397,9 +387,8 @@ RTA ::= < Diameter Header: 287, PXY > - - -@grouped + +@grouped

Defines the contents of the AVPs of the application having type @@ -424,9 +413,8 @@ Specifying a Vendor-Id in the definition of a grouped AVP is equivalent to specifying it with @avp_vendor_id.

- - -@enum Name + +@enum Name

Defines values of AVP Name having type Enumerated. @@ -452,9 +440,8 @@ REMOVE_SIP_SERVER 3 - - -@end + +@end

Causes parsing of the dictionary to terminate: diff --git a/lib/diameter/doc/src/diameter_examples.xml b/lib/diameter/doc/src/diameter_examples.xml index 853ef96bb3..2e1f2b3c03 100644 --- a/lib/diameter/doc/src/diameter_examples.xml +++ b/lib/diameter/doc/src/diameter_examples.xml @@ -42,4 +42,3 @@ Example code can be found in the diameter application's examples subdirectory.

- diff --git a/lib/diameter/doc/src/diameter_transport.xml b/lib/diameter/doc/src/diameter_transport.xml index 736d4cbfbd..294e8a8864 100644 --- a/lib/diameter/doc/src/diameter_transport.xml +++ b/lib/diameter/doc/src/diameter_transport.xml @@ -65,9 +65,8 @@ parent).

- - -message() = binary() | &codec_packet; + +message() = binary() | &codec_packet;

A Diameter message as passed over the transport interface.

@@ -160,9 +159,9 @@ It should exit if its transport connection with its peer is lost.

-
+ MESSAGES

@@ -234,7 +233,7 @@ established a connection with the peer. Not sent if the transport process has Type=connect.

-{diameter, {self(), connected, Remote}} +{diameter, {self(), connected, Remote}} {diameter, {self(), connected, Remote, [LocalAddr]}}

diff --git a/lib/diameter/doc/src/diameterc.xml b/lib/diameter/doc/src/diameterc.xml index 5bffe9a771..8f1c660989 100644 --- a/lib/diameter/doc/src/diameterc.xml +++ b/lib/diameter/doc/src/diameterc.xml @@ -11,7 +11,7 @@

-20112013 +20112016 Ericsson AB. All Rights Reserved. @@ -79,14 +79,14 @@ Write generated source to the specified directory. Defaults to the current working directory.

- +

Suppress erl and hrl generation, respectively.

-]]> +]]> ]]>

-- cgit v1.2.3 From 392a0a77a9c4fc4c9bdca1c2e6599ce34f07c93b Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Wed, 7 Sep 2016 23:05:47 +0200 Subject: Let unfortunate min_heap_size setting be disabled 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. --- lib/diameter/src/base/diameter_lib.erl | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/diameter/src/base/diameter_lib.erl b/lib/diameter/src/base/diameter_lib.erl index b835e87967..3928769b5e 100644 --- a/lib/diameter/src/base/diameter_lib.erl +++ b/lib/diameter/src/base/diameter_lib.erl @@ -299,8 +299,28 @@ spawn_opts(server, Opts) -> spawn_opts(worker, Opts) -> opts(5000, Opts). -opts(HeapSize, Opts) -> - [{min_heap_size, HeapSize} | lists:keydelete(min_heap_size, 1, Opts)]. +%% These setting are historical rather than useful. In particular, the +%% server setting can bloat many processes unnecessarily. Let them be +%% disabled with -diameter min_heap_size false. + +opts(Def, Opts) -> + Key = min_heap_size, + case getenv(Key, Def) of + N when is_integer(N), 0 =< N -> + [{Key, N} | lists:keydelete(Key, 1, Opts)]; + _ -> + Opts + end. + +%% getenv/1 + +getenv(Key, Def) -> + case application:get_env(Key) of + {ok, T} -> + T; + undefined -> + Def + end. %% --------------------------------------------------------------------------- %% # wait/1 -- cgit v1.2.3 From 3e64e10bb02929ea25b92ae7da831f80324e0e77 Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Sun, 11 Sep 2016 14:36:33 +0200 Subject: Update appup for 19.1 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. --- lib/diameter/src/diameter.appup.src | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/diameter/src/diameter.appup.src b/lib/diameter/src/diameter.appup.src index 618d5a7f10..b1b8e38d39 100644 --- a/lib/diameter/src/diameter.appup.src +++ b/lib/diameter/src/diameter.appup.src @@ -49,7 +49,11 @@ {"1.10", [{restart_application, diameter}]}, %% 18.0 {"1.11", [{restart_application, diameter}]}, %% 18.1 {"1.11.1", [{restart_application, diameter}]}, %% 18.2 - {"1.11.2", [{restart_application, diameter}]} %% 18.3 + {"1.11.2", [{restart_application, diameter}]}, %% 18.3 + {"1.12", [{load_module, diameter_lib}, %% 19.0 + {load_module, diameter_traffic}, + {load_module, diameter_tcp}, + {load_module, diameter_sctp}]} ], [ {"0.9", [{restart_application, diameter}]}, @@ -80,6 +84,10 @@ {"1.10", [{restart_application, diameter}]}, {"1.11", [{restart_application, diameter}]}, {"1.11.1", [{restart_application, diameter}]}, - {"1.11.2", [{restart_application, diameter}]} + {"1.11.2", [{restart_application, diameter}]}, + {"1.12", [{load_module, diameter_sctp}, + {load_module, diameter_tcp}, + {load_module, diameter_traffic}, + {load_module, diameter_lib}]} ] }. -- cgit v1.2.3 From 3863fc2feecff6f9945082d0b08ff8e423a8da4c Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Sun, 11 Sep 2016 14:46:07 +0200 Subject: vsn -> 1.12.1 --- lib/diameter/vsn.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/diameter/vsn.mk b/lib/diameter/vsn.mk index cb750c69a3..23219950bb 100644 --- a/lib/diameter/vsn.mk +++ b/lib/diameter/vsn.mk @@ -17,5 +17,5 @@ # %CopyrightEnd% APPLICATION = diameter -DIAMETER_VSN = 1.12 +DIAMETER_VSN = 1.12.1 APP_VSN = $(APPLICATION)-$(DIAMETER_VSN)$(PRE_VSN) -- cgit v1.2.3