aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/application_SUITE_data
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2014-02-18 17:21:55 +0100
committerDan Gudmundsson <[email protected]>2014-02-19 15:32:19 +0100
commit397e69fa95457f9660831ba1e551c784eb61e93e (patch)
tree4a77b0bc80de8adfd3ec9e70b08c276220cafacb /lib/kernel/test/application_SUITE_data
parent6c9002f9174d40b69b3a5bcd5ef219ce4ceb3622 (diff)
downloadotp-397e69fa95457f9660831ba1e551c784eb61e93e.tar.gz
otp-397e69fa95457f9660831ba1e551c784eb61e93e.tar.bz2
otp-397e69fa95457f9660831ba1e551c784eb61e93e.zip
kernel: Fix an application terminate deadlock possibility
Could happen if get_child was called during terminate. io (since it is a group_leader) also causes problems after get_child was called. Split up and do it async.
Diffstat (limited to 'lib/kernel/test/application_SUITE_data')
-rw-r--r--lib/kernel/test/application_SUITE_data/deadlock/deadlock.app2
-rw-r--r--lib/kernel/test/application_SUITE_data/deadlock/deadlock.erl12
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/kernel/test/application_SUITE_data/deadlock/deadlock.app b/lib/kernel/test/application_SUITE_data/deadlock/deadlock.app
index 0c1001bed6..233c7a3f76 100644
--- a/lib/kernel/test/application_SUITE_data/deadlock/deadlock.app
+++ b/lib/kernel/test/application_SUITE_data/deadlock/deadlock.app
@@ -4,5 +4,5 @@
{applications, [kernel, stdlib, sasl]},
{modules, [deadlock]},
{mod, {deadlock, []}},
- {env, [{fail_start, false}]}
+ {env, [{fail_start, false}, {fail_stop, false}]}
]}.
diff --git a/lib/kernel/test/application_SUITE_data/deadlock/deadlock.erl b/lib/kernel/test/application_SUITE_data/deadlock/deadlock.erl
index 5f68bf9078..3ef6105371 100644
--- a/lib/kernel/test/application_SUITE_data/deadlock/deadlock.erl
+++ b/lib/kernel/test/application_SUITE_data/deadlock/deadlock.erl
@@ -21,7 +21,7 @@ init([sup]) ->
{ok, {{one_for_one, 5, 10}, [
{
sasl_syslog_dm, {?MODULE, start_link, []},
- permanent, brutal_kill, worker,
+ permanent, 25000, worker,
[deadlock]
}
]}};
@@ -32,6 +32,8 @@ init([sup]) ->
init([child]) ->
case application:get_env(deadlock, fail_start) of
{ok, false} ->
+ process_flag(trap_exit, true),
+ io:format("~p: Traps exit~n",[?MODULE]),
%% we must not fail on the first init, otherwise supervisor
%% terminates immediately
{ok, []};
@@ -50,6 +52,14 @@ handle_info(_Msg, State) ->
{noreply, State}.
terminate(_Reason, _State) ->
+ case application:get_env(deadlock, fail_stop) of
+ {ok, false} -> ok;
+ {ok, Tester} ->
+ Tester ! {deadlock, self()},
+ io:format("~p: Waiting in terminate (~p)~n",[?MODULE,Tester]),
+ receive continue -> ok end
+ end,
+ io:format("~p: terminates~n", [?MODULE]),
ok.
code_change(_OldVsn, State, _Extra) ->