Fix: update buffered counter only when fwrite succeeds in rioFileWrite#14833
Open
RustyCoderX wants to merge 3 commits intoredis:unstablefrom
Open
Fix: update buffered counter only when fwrite succeeds in rioFileWrite#14833RustyCoderX wants to merge 3 commits intoredis:unstablefrom
RustyCoderX wants to merge 3 commits intoredis:unstablefrom
Conversation
|
Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset. In case there are security findings, they will be communicated to you as a comment inside the PR. Hope you’ll enjoy using Jit. Questions? Comments? Want to learn more? Get in touch with us. |
sundb
reviewed
Mar 2, 2026
| if (!r->io.file.autosync) return fwrite(buf,len,1,r->io.file.fp); | ||
| if (!r->io.file.autosync) { | ||
| if (fwrite(buf,len,1,r->io.file.fp) == 0) return 0; | ||
| r->io.file.buffered += len; |
Collaborator
There was a problem hiding this comment.
what's the point of increasing it if autosync is turned off?
Collaborator
There was a problem hiding this comment.
@RustyCoderX I think you've misunderstood. What I mean is that io.file.buffered only works when autosync is enabled. If it's disabled, why bother to update it?
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.
Note
Low Risk
Low-risk, localized changes to
rioFileWrite/rioSetAutoSyncthat adjust internal buffering counters; main risk is subtle behavior change in file I/O accounting around persistence syncing.Overview
Fixes file-backed
riobuffering accounting when autosync is disabled by only incrementingio.file.bufferedafterfwrite()succeeds (and returning failure on a short/failed write).Also resets
io.file.bufferedwhenrioSetAutoSync(..., 0)disables autosync, avoiding later assertion failures if autosync is re-enabled with a smaller threshold.Written by Cursor Bugbot for commit 5656a47. This will update automatically on new commits. Configure here.