aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/logger_disk_log_h.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-09-14 14:12:13 +0200
committerSiri Hansen <[email protected]>2018-09-14 14:12:13 +0200
commit6073d37a5a0691704d0fa1a5ff9289ba9e35c8ed (patch)
tree4c6b91691981f5713904638974635dfe181eb7a1 /lib/kernel/src/logger_disk_log_h.erl
parent48a1c458a46dcd1f031fd3b9689af80b32b4a6a2 (diff)
downloadotp-6073d37a5a0691704d0fa1a5ff9289ba9e35c8ed.tar.gz
otp-6073d37a5a0691704d0fa1a5ff9289ba9e35c8ed.tar.bz2
otp-6073d37a5a0691704d0fa1a5ff9289ba9e35c8ed.zip
[logger] Read config before terminating handler process
When a handler process is terminated due to overload, it reads its configuration from the configuration database, so it can be restarted with the same configuration after a small delay. This was earlier done in a different process, which was spawned off from the terminate function. This caused a race condition, where in some cases, the configuration was already removed before it could be read. The reason for spawning off a process, is to avoid a deadlock due to the call to logger:remove_handler/1. This commit moves the call to logger:get_handler_config/1 back to the handler process - to ensure that the data is still there, but keeps the call to logger:remove_handler/1 in the spawned off process - to avoid deadlock.
Diffstat (limited to 'lib/kernel/src/logger_disk_log_h.erl')
-rw-r--r--lib/kernel/src/logger_disk_log_h.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/kernel/src/logger_disk_log_h.erl b/lib/kernel/src/logger_disk_log_h.erl
index 26375373aa..a8f141f135 100644
--- a/lib/kernel/src/logger_disk_log_h.erl
+++ b/lib/kernel/src/logger_disk_log_h.erl
@@ -426,8 +426,9 @@ terminate(Reason, State = #{id := Name}) ->
_ = logger_h_common:cancel_timer(maps:get(rep_sync_tref, State,
undefined)),
_ = close_disk_log(Name, normal),
+ ok = logger_h_common:stop_or_restart(Name, Reason, State),
unregister(?name_to_reg_name(?MODULE, Name)),
- logger_h_common:stop_or_restart(Name, Reason, State).
+ ok.
code_change(_OldVsn, State, _Extra) ->
{ok, State}.