aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-12-03 11:23:33 +0100
committerSiri Hansen <[email protected]>2018-12-03 11:23:33 +0100
commit721b04340b666d476732dfba31f5c89091085d6e (patch)
treefd89afe4ac587729d7d216740ae1f098890035eb
parentec87234564e336d5ba7d2edd330486731d1a2027 (diff)
parent38c038b16835726c1273c57ed806d304498b3aa7 (diff)
downloadotp-721b04340b666d476732dfba31f5c89091085d6e.tar.gz
otp-721b04340b666d476732dfba31f5c89091085d6e.tar.bz2
otp-721b04340b666d476732dfba31f5c89091085d6e.zip
Merge branch 'siri/logger/unexpected-exit-from-simple/ERL-788/OTP-15466' into maint
* siri/logger/unexpected-exit-from-simple/ERL-788/OTP-15466: [logger] Unlink simple handler before terminating
-rw-r--r--lib/kernel/src/logger_simple_h.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/kernel/src/logger_simple_h.erl b/lib/kernel/src/logger_simple_h.erl
index 8b51dd8569..fe181722f3 100644
--- a/lib/kernel/src/logger_simple_h.erl
+++ b/lib/kernel/src/logger_simple_h.erl
@@ -50,7 +50,6 @@ removing_handler(#{id:=simple}) ->
ok;
Pid ->
Ref = erlang:monitor(process,Pid),
- unlink(Pid),
Pid ! stop,
receive {'DOWN',Ref,process,Pid,_} ->
ok
@@ -99,7 +98,11 @@ loop(Buffer) ->
replay_buffer(Buffer);
_ ->
ok
- end;
+ end,
+ %% Before stopping, we unlink the logger process to avoid
+ %% an unexpected EXIT message
+ unlink(whereis(logger)),
+ ok;
{log,#{msg:=_,meta:=#{time:=_}}=Log} ->
do_log(Log),
loop(update_buffer(Buffer,Log));