diff options
author | Siri Hansen <[email protected]> | 2018-07-06 15:27:42 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2018-07-13 12:20:26 +0200 |
commit | 0a4834e59f2aac7b76331410bcee641d375d8ec0 (patch) | |
tree | a81ce74a20a33777f5f5c2d45cb908b6bf560b74 /lib/kernel/src/logger_std_h.erl | |
parent | 4ae5136ccb68bed0e72e1f45d34d1a8b44594590 (diff) | |
download | otp-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_std_h.erl')
-rw-r--r-- | lib/kernel/src/logger_std_h.erl | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/kernel/src/logger_std_h.erl b/lib/kernel/src/logger_std_h.erl index 480fafd6d8..9a2a1443b3 100644 --- a/lib/kernel/src/logger_std_h.erl +++ b/lib/kernel/src/logger_std_h.erl @@ -467,7 +467,8 @@ start(Name, Config, HandlerState) -> type => worker, modules => [?MODULE]}, case supervisor:start_child(logger_sup, LoggerStdH) of - {ok,_Pid,Config1} -> + {ok,Pid,Config1} -> + ok = logger_handler_watcher:register_handler(Name,Pid), {ok,Config1}; Error -> Error @@ -485,8 +486,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. |