-
Notifications
You must be signed in to change notification settings - Fork 1.4k
test_output_as_buffered_retries: fix flaky test #4877
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
Merged
ashie
merged 1 commit into
fluent:master
from
Watson1978:test_output_as_buffered_retries
Mar 24, 2025
Merged
test_output_as_buffered_retries: fix flaky test #4877
ashie
merged 1 commit into
fluent:master
from
Watson1978:test_output_as_buffered_retries
Mar 24, 2025
Conversation
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
Signed-off-by: Shizuo Fujita <[email protected]>
1880b84 to
90a0025
Compare
ashie
approved these changes
Mar 24, 2025
Contributor
Author
|
Thanks! |
daipom
pushed a commit
that referenced
this pull request
Apr 23, 2025
**Which issue(s) this PR fixes**: Fixes #4873 **What this PR does / why we need it**: Before invoke `@num_errors_metrics.inc`, the `does retries correctly when #try_write fails` test will be failed if thread will be switched at https://github.com/fluent/fluentd/blob/f34a2531fcfc4e8958f665301d48558de200aa3a/lib/fluent/plugin/output.rb#L1313-L1315 It is easy to reproduce by adding `sleep` just before `@num_errors_metrics.inc`, like: ```diff diff --git a/lib/fluent/plugin/output.rb b/lib/fluent/plugin/output.rb index a987937..d97d8ec6 100644 --- a/lib/fluent/plugin/output.rb +++ b/lib/fluent/plugin/output.rb @@ -1312,6 +1312,7 @@ def check_slow_flush(start) def update_retry_state(chunk_id, using_secondary, error = nil) @retry_mutex.synchronize do + sleep 0.1 @num_errors_metrics.inc chunk_id_hex = dump_unique_id_hex(chunk_id) ``` This patch will wait until `@num_errors_metrics.inc` is invoked. **Docs Changes**: **Release Note**: Signed-off-by: Shizuo Fujita <[email protected]> Signed-off-by: Daijiro Fukuda <[email protected]>
daipom
added a commit
that referenced
this pull request
Apr 23, 2025
… (#4915) **Which issue(s) this PR fixes**: Backport #4877 Fixes #4873 **What this PR does / why we need it**: Before invoke `@num_errors_metrics.inc`, the `does retries correctly when #try_write fails` test will be failed if thread will be switched at https://github.com/fluent/fluentd/blob/f34a2531fcfc4e8958f665301d48558de200aa3a/lib/fluent/plugin/output.rb#L1313-L1315 It is easy to reproduce by adding `sleep` just before `@num_errors_metrics.inc`, like: ```diff diff --git a/lib/fluent/plugin/output.rb b/lib/fluent/plugin/output.rb index a987937..d97d8ec6 100644 --- a/lib/fluent/plugin/output.rb +++ b/lib/fluent/plugin/output.rb @@ -1312,6 +1312,7 @@ def check_slow_flush(start) def update_retry_state(chunk_id, using_secondary, error = nil) @retry_mutex.synchronize do + sleep 0.1 @num_errors_metrics.inc chunk_id_hex = dump_unique_id_hex(chunk_id) ``` This patch will wait until `@num_errors_metrics.inc` is invoked. **Docs Changes**: **Release Note**: <!-- Thank you for contributing to Fluentd! Your commits need to follow DCO: https://probot.github.io/apps/dco/ And please provide the following information to help us make the most of your pull request: --> **Which issue(s) this PR fixes**: Fixes # **What this PR does / why we need it**: **Docs Changes**: **Release Note**: Signed-off-by: Shizuo Fujita <[email protected]> Signed-off-by: Daijiro Fukuda <[email protected]> Co-authored-by: Shizuo Fujita <[email protected]>
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport to v1.16
We will backport this fix to the LTS branch
backported
"backport to LTS" is done
CI
Test/CI issues
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 #4873
What this PR does / why we need it:
Before invoke
@num_errors_metrics.inc, thedoes retries correctly when #try_write failstest will be failed if thread will be switched atfluentd/lib/fluent/plugin/output.rb
Lines 1313 to 1315 in f34a253
It is easy to reproduce by adding
sleepjust before@num_errors_metrics.inc, like:This patch will wait until
@num_errors_metrics.incis invoked.Docs Changes:
Release Note: