Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output: Fix a potential crash bug of flush thread #3755

Merged
merged 1 commit into from May 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/fluent/plugin/output.rb
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