test_out_buffer: fix flaky BufferOutputTest#write#5443
Open
Watson1978 wants to merge 1 commit into
Open
Conversation
out_buffer flushes its buffer immediately and re-emits events asynchronously via the flush thread. The test driver's wait_flush_completion only waits until the chunk leaves the buffer queue (via dequeue_chunk), not until write() actually emits. When the flush thread is still between dequeue_chunk and write, run() proceeds to shutdown, where EventEmitter#after_shutdown nil-s out @router before Output#after_shutdown joins the flush thread. The in-flight write then emits to a nil router and the event is dropped, making d.events empty. This surfaces as a flaky failure under CI load. Pass expect_emits: 1 so run() waits until the event is actually emitted (while the router is still valid) before shutting the plugin down. Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Watson1978
force-pushed
the
fix-flaky-test-out-buffer
branch
from
July 19, 2026 06:29
a418e2e to
108e4de
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue(s) this PR fixes:
Fixes #
What this PR does / why we need it:
out_bufferflushes its buffer immediately and re-emits events asynchronously via the flush thread.The test driver's
wait_flush_completiononly waits until the chunk leaves the buffer queue , not untilwrite()actually emits.When the flush thread is still between
dequeue_chunkandwrite,run()proceeds to shutdown, whereEventEmitter#after_shutdownnil-s out @router beforeOutput#after_shutdownjoins the flush thread.The in-flight write then emits to a
nilrouter and the event is dropped, makingd.eventsempty. This surfaces as a flaky failure under CI load.Pass
expect_emits: 1sorun()waits until the event is actually emitted (while the router is still valid) before shutting the plugin down.This PR should fix following error:
Ref. https://github.com/fluent/fluentd/actions/runs/29478564922/job/87556893864#step:6:5358
Docs Changes:
N/A
Release Note:
N/A