Skip to content

Commit

Permalink
Merge pull request #3755 from fluent/issue3718
Browse files Browse the repository at this point in the history
output: Fix a potential crash bug of flush thread
  • Loading branch information
ashie authored May 24, 2022
2 parents 8f35549 + 28cc886 commit 197da19
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/fluent/plugin/output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ def initialize
@dequeued_chunks_mutex = nil
@output_enqueue_thread = nil
@output_flush_threads = nil
@output_flush_thread_current_position = 0

@simple_chunking = nil
@chunk_keys = @chunk_key_accessors = @chunk_key_time = @chunk_key_tag = nil
Expand Down Expand Up @@ -492,6 +493,7 @@ def start
@dequeued_chunks = []
@dequeued_chunks_mutex = Mutex.new

@output_flush_thread_current_position = 0
@buffer_config.flush_thread_count.times do |i|
thread_title = "flush_thread_#{i}".to_sym
thread_state = FlushThreadState.new(nil, nil, Mutex.new, ConditionVariable.new)
Expand All @@ -503,7 +505,6 @@ def start
@output_flush_threads << thread_state
end
end
@output_flush_thread_current_position = 0

if !@under_plugin_development && (@flush_mode == :interval || @chunk_key_time)
@output_enqueue_thread = thread_create(:enqueue_thread, &method(:enqueue_thread_run))
Expand Down

0 comments on commit 197da19

Please sign in to comment.