Skip to content

Commit

Permalink
Merge pull request #2678 from ashie/fix-thread-error
Browse files Browse the repository at this point in the history
Fix a potential bug that ThreadError may occur on SIGUSR1
  • Loading branch information
repeatedly authored Oct 31, 2019
2 parents 5d82dce + c170f43 commit 572aa34
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/fluent/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ def supervisor_sigusr1_handler
if log = config[:logger_initializer]
# Creating new thread due to mutex can't lock
# in main thread during trap context
Thread.new {
Thread.new do
log.reopen!
}.run
end
end

if config[:worker_pid]
Expand Down Expand Up @@ -721,7 +721,7 @@ def install_main_process_signal_handlers
def flush_buffer
# Creating new thread due to mutex can't lock
# in main thread during trap context
Thread.new {
Thread.new do
begin
$log.debug "fluentd main process get SIGUSR1"
$log.info "force flushing buffered events"
Expand All @@ -731,7 +731,7 @@ def flush_buffer
rescue Exception => e
$log.warn "flushing thread error: #{e}"
end
}.run
end
end

def logging_with_console_output
Expand Down

0 comments on commit 572aa34

Please sign in to comment.