test_fluentd: read until EOF in assert_fluentd_fails_to_start#5447
Open
Watson1978 wants to merge 1 commit into
Open
test_fluentd: read until EOF in assert_fluentd_fails_to_start#5447Watson1978 wants to merge 1 commit into
Watson1978 wants to merge 1 commit into
Conversation
Gating the read loop on `process_exist?(pid)` is racy: fluentd can write its final error line and exit right after `eager_read` drains the pipe, so the loop exits (process gone) before that last line is read. The error message is then missing from `stdio_buf` and the assertion fails even though fluentd did fail to start as expected. This showed up as a flaky failure of "fails to launch fluentd if specified root path is invalid path for directory": the captured output ended at "bundler: failed to load command:" without the following "non directory entry exists:" line. Loop until the pipe reaches EOF (the write-end is closed when the process exits) instead, so the remaining buffered output is always drained. The success case still breaks early once the worker is running, and hangs are still caught by the outer `waiting(timeout)`. This mirrors the existing EOF handling in `assert_log_matches`. Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
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:
Gating the read loop on
process_exist?(pid)is racy: fluentd can write its final error line and exit right aftereager_readdrains the pipe, so the loop exits (process gone) before that last line is read. The error message is then missing fromstdio_bufand the assertion fails even though fluentd did fail to start as expected.This showed up as a flaky failure of "fails to launch fluentd if specified root path is invalid path for directory": the captured output ended at "bundler: failed to load command:" without the following "non directory entry exists:" line.
Loop until the pipe reaches EOF (the write-end is closed when the process exits) instead, so the remaining buffered output is always drained. The success case still breaks early once the worker is running, and hangs are still caught by the outer
waiting(timeout). This mirrors the existing EOF handling inassert_log_matches.This PR will fix following error:
Ref. https://github.com/fluent/fluentd/actions/runs/29680404414/job/88175417915?pr=5446#step:6:5364
Docs Changes:
N/A
Release Note:
N/A