aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_master_event.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2013-02-12 14:27:31 +0100
committerPeter Andersson <[email protected]>2013-02-12 14:27:31 +0100
commitfff6e569725f05c1b6498985cb946986c5ea8f48 (patch)
tree5e868bd051aa11a0950be408371abbcf31dee786 /lib/common_test/src/ct_master_event.erl
parente1676e6c579fa34d07694784afd0902433802bfb (diff)
downloadotp-fff6e569725f05c1b6498985cb946986c5ea8f48.tar.gz
otp-fff6e569725f05c1b6498985cb946986c5ea8f48.tar.bz2
otp-fff6e569725f05c1b6498985cb946986c5ea8f48.zip
Fix problem with hanging event handler
OTP-10634
Diffstat (limited to 'lib/common_test/src/ct_master_event.erl')
-rw-r--r--lib/common_test/src/ct_master_event.erl22
1 files changed, 18 insertions, 4 deletions
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.
%%--------------------------------------------------------------------