aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2011-11-17 16:30:25 +0100
committerSiri Hansen <[email protected]>2011-11-17 16:30:25 +0100
commit1c995165c752468c5c49f84b0c1bae7991cde008 (patch)
tree3fc69294087e7672c5bfd1025467b165141c5229 /lib/kernel/src
parent80775f1e41a38a617f779bc14736d8b281c12839 (diff)
parent77ffc0d747f913c47d9e5305907a407d87883ba2 (diff)
downloadotp-1c995165c752468c5c49f84b0c1bae7991cde008.tar.gz
otp-1c995165c752468c5c49f84b0c1bae7991cde008.tar.bz2
otp-1c995165c752468c5c49f84b0c1bae7991cde008.zip
Merge branch 'siri/kernel/application-shutdown-timeout/OTP-9540'
* siri/kernel/application-shutdown-timeout/OTP-9540: Add documentation and test for kernel env var shutdown_timeout Add env var shutdown_timeout to kernel to avoid deadlock on node shutdown
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/application_controller.erl19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/kernel/src/application_controller.erl b/lib/kernel/src/application_controller.erl
index 42f527f400..ebfe84463a 100644
--- a/lib/kernel/src/application_controller.erl
+++ b/lib/kernel/src/application_controller.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -1180,10 +1180,27 @@ terminate(Reason, S) ->
_ ->
ok
end,
+ ShutdownTimeout =
+ case application:get_env(kernel, shutdown_timeout) of
+ undefined -> infinity;
+ {ok,T} -> T
+ end,
foreach(fun({_AppName, Id}) when is_pid(Id) ->
+ Ref = erlang:monitor(process, Id),
+ unlink(Id),
exit(Id, shutdown),
receive
+ %% Proc died before link
{'EXIT', Id, _} -> ok
+ after 0 ->
+ receive
+ {'DOWN', Ref, process, Id, _} -> ok
+ after ShutdownTimeout ->
+ exit(Id, kill),
+ receive
+ {'DOWN', Ref, process, Id, _} -> ok
+ end
+ end
end;
(_) -> ok
end,