Skip to content

buffer: describe what total_limit_size and overflow_action apply to - #732

Merged
Watson1978 merged 2 commits into
fluent:1.0from
NopeCharon:buffer-total-limit-size-overflow
Nov 30, 2026
Merged

Watson1978 merged 2 commits into
fluent:1.0from
NopeCharon:buffer-total-limit-size-overflow

Conversation

@NopeCharon

@NopeCharon NopeCharon commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

The Buffer Section article says that once total_limit_size is reached "all append operations will fail with error (and data will be lost)", and that overflow_action applies "when its buffer queue is full". Neither matches the code, which is what #163 ran into:

  • Buffer#storable? compares total_limit_size with the staged and queued sizes together. A chunk being flushed stays in the queued size until it is purged, so staged chunks, queued chunks and chunks being flushed all count.
  • Output#write_guard handles the resulting BufferOverflowError according to overflow_action:
    • throw_exception raises the error. With <label @ERROR>, the events are routed to that label. Otherwise the error reaches the input plugin that emitted the events, and whether the events are lost depends on that plugin. For example, in_tail keeps the rejected lines and sends them again later.
    • block waits until the buffer can store more data and then retries the write, so the events are not rejected because of the limit. The exception is a shutdown while the buffer is still full, which re-raises the error.
    • drop_oldest_chunk only drops a chunk in the queue. Staged chunks and chunks being flushed are never dropped. If the total is still at or above the limit afterwards, for example because the queue was empty, the error is raised as with throw_exception.

This PR updates the total_limit_size and overflow_action descriptions in configuration/buffer-section.md to match. It also fixes the first sentence of overflow_action in output/README.md, which said "when the queue becomes full" as well. The new text follows the analysis in the issue comments.

Fixes #163

The description of total_limit_size said that all append operations
fail and data is lost once the limit is reached, and the description of
overflow_action said it applies when the buffer queue is full. Neither
is accurate.

Buffer#storable? compares total_limit_size with the size of the staged
and queued chunks together, and Output#write_guard handles the
resulting BufferOverflowError according to overflow_action:

* throw_exception raises the error to the input plugin, which decides
  whether the events are lost.
* block waits until the buffer can store more data and retries the
  write, so the events are not lost, unless Fluentd is shut down while
  waiting.
* drop_oldest_chunk can only drop a chunk in the queue. If there is
  none, or dropping one does not free enough space, the error is
  raised as with throw_exception.

Update both descriptions in the Buffer Section article, and the
description of overflow_action in the Output Plugins article.

Fixes fluent#163

Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
@netlify

netlify Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

👷 Deploy request for fluentd-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 932efb3

@Watson1978 Watson1978 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. The main corrections match the code. The stage counts toward total_limit_size, block retries the write, and drop_oldest_chunk only drops queued chunks.

I found two places where the new text is still not accurate:

  • Chunks that are being flushed also count toward total_limit_size (lines 417 and 526 of configuration/buffer-section.md, and line 160 of output/README.md).
  • With <label @ERROR>, throw_exception does not raise the error to the input plugin (lines 527-529).

I left suggestions for both, and two small nits. I checked each case by running Fluentd (master, 1.20.1).

Comment thread configuration/buffer-section.md Resolved
Comment thread configuration/buffer-section.md Resolved
Comment thread configuration/buffer-section.md Resolved
Comment thread configuration/buffer-section.md Resolved
Comment thread configuration/buffer-section.md Resolved
Comment thread output/README.md Resolved
@Watson1978 Watson1978 added the bug Something isn't working label Nov 29, 2026
Chunks that are being flushed stay in the queued size until they are
purged, so they count toward total_limit_size as well. The limit is
also checked only once before each write, so one write can go beyond
it. Describe both, and say "all chunks in the buffer" wherever the
text said "the staged and queued chunks".

With <label @error>, throw_exception routes the events to that label
instead of raising the error to the input plugin, so mention that.

For block, say that the events are not rejected because of the limit
rather than that they are not lost, and that the error is raised at
shutdown only while the buffer is still full. For drop_oldest_chunk,
join the split sentence and describe the recheck of the limit after
trying to drop a chunk.

Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>

@Watson1978 Watson1978 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for applying the suggestions. I ran the cases again on Fluentd master (1.20.1), and the new text matches the behavior.

@Watson1978
Watson1978 merged commit ff57b01 into fluent:1.0 Nov 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need clarification on behavior of total_limit_size and overflow_action parameters

2 participants