out_s3: guard current_buffer_size subtraction against underflow - #12271
Open
univbyn-blip wants to merge 1 commit into
Open
out_s3: guard current_buffer_size subtraction against underflow#12271univbyn-blip wants to merge 1 commit into
univbyn-blip wants to merge 1 commit into
Conversation
Buffer files recovered from a previous run are not accounted into current_buffer_size at startup, but s3_store_file_delete() subtracted their size unconditionally. The unsigned counter wraps to ~2^64 and the store_dir_limit_size check then rejects every new chunk (Buffer is full / chunk cannot be retried), causing data loss until restart. Clamp the subtraction at zero, matching the guard already used on the quarantine accounting path. Fixes fluent#12270 Signed-off-by: yena <univbyn@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe S3 file deletion logic now prevents ChangesS3 buffer accounting
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
|
This will be superseded by #12266. |
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.
Fixes #12270
s3_store_file_delete()subtracteds3_file->sizefromctx->current_buffer_sizeunconditionally. Buffer files recovered froma previous run are not accounted into
current_buffer_sizeat startup,so deleting them after upload wraps the unsigned counter around to
~2^64. The
store_dir_limit_sizecheck then treats the buffer aspermanently full and rejects every new chunk ("Buffer is full",
"chunk cannot be retried"), causing data loss until restart.
Clamp the subtraction at zero, using the same pattern already applied
on the quarantine accounting path in
s3.c.Observed in production on 5.0.9 (Kubernetes DaemonSet,
store_diron ahostPath volume surviving pod restarts):
18446744073709314048 == 2^64 - 237568— the counter went "negative"by exactly the size of the recovered-and-deleted files.
Testing
Documentation
Backporting
Summary by CodeRabbit