diff options
author | Anders Svensson <[email protected]> | 2017-02-09 17:18:21 +0100 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2017-06-11 16:30:34 +0200 |
commit | 9ff8491996381cb2297671b94b7282a7ffb2136f (patch) | |
tree | 7a0504de92ca395357cd18645b9bf2c853ab7c34 /lib/diameter/test/diameter_watchdog_SUITE.erl | |
parent | 69b0c1878a95bdfcfe9043fbccf8a0f7b4545bdc (diff) | |
download | otp-9ff8491996381cb2297671b94b7282a7ffb2136f.tar.gz otp-9ff8491996381cb2297671b94b7282a7ffb2136f.tar.bz2 otp-9ff8491996381cb2297671b94b7282a7ffb2136f.zip |
Don't send from receiving transport processes
Both diameter_tcp and diameter_sctp are susceptible to deadlock since a
peer that blocks send also prevents additional messages from being
received. Send from a process that's paired with the transport process
to avoid this. Use the existing monitor process in the TCP case, add one
in the SCTP case.
This has been the reason for many sporadic testcase failures, mostly in
diameter_traffic_SUITE.
Diffstat (limited to 'lib/diameter/test/diameter_watchdog_SUITE.erl')
-rw-r--r-- | lib/diameter/test/diameter_watchdog_SUITE.erl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/diameter/test/diameter_watchdog_SUITE.erl b/lib/diameter/test/diameter_watchdog_SUITE.erl index 6d22ddcc18..5ae951f7c2 100644 --- a/lib/diameter/test/diameter_watchdog_SUITE.erl +++ b/lib/diameter/test/diameter_watchdog_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2015. All Rights Reserved. +%% Copyright Ericsson AB 2010-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -569,12 +569,12 @@ send(_, Sock, <<_:32, 1:1, _:7, 280:24, _:32, EId:32, HId:32, _/binary>>) -> {'Origin-Host', "XXX"}, {'Origin-Realm', ?REALM}]}, #diameter_packet{bin = Bin} = diameter_codec:encode(?BASE, Pkt), - self() ! {tcp, Sock, Bin}, + tpid(Sock) ! {tcp, Sock, Bin}, ok; %% First outgoing DWA. send(init, Sock, Bin) -> - [{{?MODULE, _, T}, _}] = diameter_reg:wait({?MODULE, self(), '_'}), + [{{?MODULE, _, T}, _}] = diameter_reg:wait({?MODULE, tpid(Sock), '_'}), putr(config, T), send(Sock, Bin); @@ -607,6 +607,14 @@ send(N, Sock, <<_:32, 0:1, _:7, 280:24, _/binary>> = Bin) -> putr(config, N-1), gen_tcp:send(Sock, Bin). +%% tpid/1 + +tpid(Sock) -> + {connected, Pid} = erlang:port_info(Sock, connected), + Pid. + +%%failback/5 + failback(Tmo, Msg, Sock, Bin, Origin) -> timer:sleep(Tmo), ok = gen_tcp:send(Sock, msg(Msg, Bin, Origin)). |