aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/logger_disk_log_h.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-07-06 15:27:42 +0200
committerSiri Hansen <[email protected]>2018-07-13 12:20:26 +0200
commit0a4834e59f2aac7b76331410bcee641d375d8ec0 (patch)
treea81ce74a20a33777f5f5c2d45cb908b6bf560b74 /lib/kernel/src/logger_disk_log_h.erl
parent4ae5136ccb68bed0e72e1f45d34d1a8b44594590 (diff)
downloadotp-0a4834e59f2aac7b76331410bcee641d375d8ec0.tar.gz
otp-0a4834e59f2aac7b76331410bcee641d375d8ec0.tar.bz2
otp-0a4834e59f2aac7b76331410bcee641d375d8ec0.zip
[kernel] Reduce risk of dead lock when terminating logger_sup
Diffstat (limited to 'lib/kernel/src/logger_disk_log_h.erl')
-rw-r--r--lib/kernel/src/logger_disk_log_h.erl8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/kernel/src/logger_disk_log_h.erl b/lib/kernel/src/logger_disk_log_h.erl
index 0a72654e11..e56531c3cb 100644
--- a/lib/kernel/src/logger_disk_log_h.erl
+++ b/lib/kernel/src/logger_disk_log_h.erl
@@ -488,7 +488,8 @@ start(Name, Config, HandlerState) ->
type => worker,
modules => [?MODULE]},
case supervisor:start_child(logger_sup, LoggerDLH) of
- {ok,_Pid,Config1} ->
+ {ok,Pid,Config1} ->
+ ok = logger_handler_watcher:register_handler(Name,Pid),
{ok,Config1};
Error ->
Error
@@ -506,8 +507,11 @@ stop(Name) ->
%% system termination in order to avoid circular attempts
%% at removing the handler (implying deadlocks and
%% timeouts).
+ %% And we don't need to do supervisor:delete_child, since
+ %% the restart type is temporary, which means that the
+ %% child specification is automatically removed from the
+ %% supervisor when the process dies.
_ = gen_server:call(Pid, stop),
- _ = supervisor:delete_child(logger_sup, Name),
ok
end.