aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2013-02-15 15:54:43 +0100
committerPeter Andersson <[email protected]>2013-02-15 15:54:56 +0100
commit90d5ffbc08de4ff974440e468e1eb20a01d308e1 (patch)
treeb05fe258a66281c0b9451eef829b9767330f34bb /lib/common_test
parentf7095c4c3ac256f2d587475d11a1cd09f9454a76 (diff)
parentfff6e569725f05c1b6498985cb946986c5ea8f48 (diff)
downloadotp-90d5ffbc08de4ff974440e468e1eb20a01d308e1.tar.gz
otp-90d5ffbc08de4ff974440e468e1eb20a01d308e1.tar.bz2
otp-90d5ffbc08de4ff974440e468e1eb20a01d308e1.zip
Merge remote branch 'origin/peppe/common_test/ct_master_evh'
* origin/peppe/common_test/ct_master_evh: Fix problem with hanging event handler OTP-10634
Diffstat (limited to 'lib/common_test')
-rw-r--r--lib/common_test/src/ct_master.erl2
-rw-r--r--lib/common_test/src/ct_master_event.erl22
2 files changed, 19 insertions, 5 deletions
diff --git a/lib/common_test/src/ct_master.erl b/lib/common_test/src/ct_master.erl
index e516f635d2..b42ff73846 100644
--- a/lib/common_test/src/ct_master.erl
+++ b/lib/common_test/src/ct_master.erl
@@ -428,7 +428,7 @@ master_loop(#state{node_ctrl_pids=[],
log(all,"TEST RESULTS",Str,[]),
log(all,"Info","Updating log files",[]),
refresh_logs(LogDirs,[]),
-
+
ct_master_event:stop(),
ct_master_logs:stop(),
ok;
diff --git a/lib/common_test/src/ct_master_event.erl b/lib/common_test/src/ct_master_event.erl
index 5877b7c6f2..fd97ab16f7 100644
--- a/lib/common_test/src/ct_master_event.erl
+++ b/lib/common_test/src/ct_master_event.erl
@@ -66,16 +66,30 @@ add_handler(Args) ->
%% Description: Stops the event manager
%%--------------------------------------------------------------------
stop() ->
- flush(),
- gen_event:stop(?CT_MEVMGR_REF).
+ case flush() of
+ {error,Reason} ->
+ ct_master_logs:log("Error",
+ "No response from CT Master Event.\n"
+ "Reason = ~p\n"
+ "Terminating now!\n",[Reason]),
+ %% communication with event manager fails, kill it
+ catch exit(whereis(?CT_MEVMGR_REF), kill);
+ _ ->
+ gen_event:stop(?CT_MEVMGR_REF)
+ end.
flush() ->
- case gen_event:call(?CT_MEVMGR_REF,?MODULE,flush) of
+ try gen_event:call(?CT_MEVMGR_REF,?MODULE,flush,1800000) of
flushing ->
timer:sleep(1),
flush();
done ->
- ok
+ ok;
+ Error = {error,_} ->
+ Error
+ catch
+ _:Reason ->
+ {error,Reason}
end.
%%--------------------------------------------------------------------