aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/test
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/test
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/test')
-rw-r--r--lib/diameter/test/diameter_reg_SUITE.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/diameter/test/diameter_reg_SUITE.erl b/lib/diameter/test/diameter_reg_SUITE.erl
index e2a1ca00c3..cd9242faa8 100644
--- a/lib/diameter/test/diameter_reg_SUITE.erl
+++ b/lib/diameter/test/diameter_reg_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2016. 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.
@@ -34,6 +34,7 @@
-export([add/1,
add_new/1,
remove/1,
+ down/1,
terms/1,
pids/1]).
@@ -56,6 +57,7 @@ tc() ->
[add,
add_new,
remove,
+ down,
terms,
pids].
@@ -88,6 +90,13 @@ remove(_) ->
[{Ref, Pid}] = ?reg:match(Ref),
Pid = self().
+down(_) ->
+ Ref = make_ref(),
+ {_, MRef} = spawn_monitor(fun() -> ?reg:add_new(Ref), timer:sleep(1000) end),
+ receive {'DOWN', MRef, process, _, _} -> ok end,
+ timer:sleep(1000),
+ [] = ?reg:match(Ref).
+
terms(_) ->
Ref = make_ref(),
true = ?reg:add_new(Ref),