Describe the bug
@stage_size drifts upward slowly under load over sustained period of time each time a partially-filled staged chunk is not subtracted when it's unstaged because a record is too big to be appended.
Eventually leading to a refusal of new writes once @stage_size + @queue_size reaches total_limit_size. Only a pod restart resets @staged.
To Reproduce
Using a tcp input and a discard output with a buffer configuration as shown below.
A constant stream of records of a size of 1.5KB causes the @stage_size to drift upwards.
Expected behavior
@staged_size does not drifts and writes are not refused, and pod restarts are not required.
Your Environment
- Fluentd version: 1.19.1
- Operating system: Debian GNU/Linux 13 (trixie)
- Kernel version: 6.12.68+
- Environment: Kubernetes
Your Configuration
fluentd.conf
<source>
@type tcp
@log_level info
port 20001
bind 0.0.0.0
tag input.json
<parse>
@type json
</parse>
</source>
<match input.json>
@type discard
@log_level info
<buffer>
@type memory
chunk_limit_size 8k
chunk_limit_records 250
total_limit_size 4m
overflow_action drop_oldest_chunk
</buffer>
</match>
out_discard.rb
require "json"
require "fluent/plugin/output"
module Fluent
module Plugin
class DiscardOutput < Output
Fluent::Plugin.register_output("discard", self)
def format(tag, time, record)
"#{JSON.generate(record)}\n"
end
def write(chunk)
# discard on purpose
end
end
end
end
Your Error Log
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 failed to write data into buffer by buffer overflow action=:drop_oldest_chunk
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 no queued chunks to be dropped for drop_oldest_chunk
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 emit transaction failed: error_class=Fluent::Plugin::Buffer::BufferOverflowError error="buffer space has too many data" location="/usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/buffer.rb:332:in 'Fluent::Plugin::Buffer#write'" tag="input.json"
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/buffer.rb:332:in 'Fluent::Plugin::Buffer#write'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/output.rb:1080:in 'block in Fluent::Plugin::Output#handle_stream_simple'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/output.rb:957:in 'Fluent::Plugin::Output#write_guard'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/output.rb:1079:in 'Fluent::Plugin::Output#handle_stream_simple'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/output.rb:947:in 'Fluent::Plugin::Output#execute_chunking'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/output.rb:877:in 'emit_buffered'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/event_router.rb:115:in 'Fluent::EventRouter#emit_stream'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/in_tcp.rb:200:in 'block in Fluent::Plugin::TcpInput#start'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin_helper/server.rb:661:in 'on_read_with_connection'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/cool.io-1.9.0/lib/cool.io/io.rb:123:in 'Coolio::IO#on_readable'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/cool.io-1.9.0/lib/cool.io/io.rb:186:in 'Coolio::IO::Watcher#on_readable'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/cool.io-1.9.0/lib/cool.io/loop.rb:88:in 'Coolio::Loop#run_once'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/cool.io-1.9.0/lib/cool.io/loop.rb:88:in 'Coolio::Loop#run'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin_helper/event_loop.rb:93:in 'block in Fluent::PluginHelper::EventLoop#start'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [warn]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin_helper/thread.rb:78:in 'block in Fluent::PluginHelper::Thread#thread_create'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 unexpected error on reading data host="a.b.c.d" port=37448 error_class=Fluent::Plugin::Buffer::BufferOverflowError error="buffer space has too many data"
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/buffer.rb:332:in 'Fluent::Plugin::Buffer#write'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/output.rb:1080:in 'block in Fluent::Plugin::Output#handle_stream_simple'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/output.rb:957:in 'Fluent::Plugin::Output#write_guard'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/output.rb:1079:in 'Fluent::Plugin::Output#handle_stream_simple'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/output.rb:947:in 'Fluent::Plugin::Output#execute_chunking'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/output.rb:877:in 'emit_buffered'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/event_router.rb:115:in 'Fluent::EventRouter#emit_stream'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin/in_tcp.rb:200:in 'block in Fluent::Plugin::TcpInput#start'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin_helper/server.rb:661:in 'on_read_with_connection'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/cool.io-1.9.0/lib/cool.io/io.rb:123:in 'Coolio::IO#on_readable'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/cool.io-1.9.0/lib/cool.io/io.rb:186:in 'Coolio::IO::Watcher#on_readable'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/cool.io-1.9.0/lib/cool.io/loop.rb:88:in 'Coolio::Loop#run_once'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/cool.io-1.9.0/lib/cool.io/loop.rb:88:in 'Coolio::Loop#run'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin_helper/event_loop.rb:93:in 'block in Fluent::PluginHelper::EventLoop#start'
2026-07-16 23:56:33 2026-07-16 21:56:33 +0000 [error]: #0 /usr/local/bundle/gems/fluentd-1.19.0/lib/fluent/plugin_helper/thread.rb:78:in 'block in Fluent::PluginHelper::Thread#thread_create'
Additional context
No response
Describe the bug
@stage_sizedrifts upward slowly under load over sustained period of time each time a partially-filled staged chunk is not subtracted when it's unstaged because a record is too big to be appended.Eventually leading to a refusal of new writes once
@stage_size+@queue_sizereachestotal_limit_size. Only a pod restart resets@staged.To Reproduce
Using a
tcpinput and adiscardoutput with abufferconfiguration as shown below.A constant stream of records of a size of 1.5KB causes the
@stage_sizeto drift upwards.Expected behavior
@staged_sizedoes not drifts and writes are not refused, and pod restarts are not required.Your Environment
Your Configuration
fluentd.conf
out_discard.rb
Your Error Log
Additional context
No response