aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-10-05 12:49:52 +0200
committerAnders Svensson <[email protected]>2017-10-05 14:41:08 +0200
commit36e4e948af8c7478dbaf5b2bdd85794f09275d3f (patch)
treee85dab51386c476c522c80139fde7983d49a9e9e /lib/diameter/src/base
parent02fd746c40e829adbe77cc526c7df904698e2534 (diff)
downloadotp-36e4e948af8c7478dbaf5b2bdd85794f09275d3f.tar.gz
otp-36e4e948af8c7478dbaf5b2bdd85794f09275d3f.tar.bz2
otp-36e4e948af8c7478dbaf5b2bdd85794f09275d3f.zip
Fix missing monitor in diameter_reg
Commit fae8ca0c inadvertently removed the monitor at add/1 and add_new/1. As a result, process death did not remove associations, causing table diameter_reg to leak entries and stop/start of a service to fail. Add a testcase to detect the problem, which existing testcases miss.
Diffstat (limited to 'lib/diameter/src/base')
-rw-r--r--lib/diameter/src/base/diameter_reg.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/diameter/src/base/diameter_reg.erl b/lib/diameter/src/base/diameter_reg.erl
index bd5db54a5c..e0c41a2834 100644
--- a/lib/diameter/src/base/diameter_reg.erl
+++ b/lib/diameter/src/base/diameter_reg.erl
@@ -238,7 +238,11 @@ handle_call({add, Uniq, Key}, {Pid, _}, S) ->
Rec = {Key, Pid},
NS = flush(Uniq, Rec, S), %% before insert
{Res, New} = insert(Uniq, Rec),
- {reply, Res, notify(add, New andalso Rec, NS)};
+ {reply, Res, notify(add, New andalso Rec, if New ->
+ add_monitor(Pid, NS);
+ true ->
+ NS
+ end)};
handle_call({remove, Key}, {Pid, _}, S) ->
Rec = {Key, Pid},