fix(mfs): add soft limit for --flush=false#10985
Merged
Conversation
adds a global counter that tracks consecutive MFS operations performed with --flush=false and fails with clear error after limit is reached. this prevents unbounded memory growth while avoiding the data corruption risks of auto-flushing. - adds Internal.MFSNoFlushLimit config - operations fail with actionable error at limit - counter resets on successful flush or any --flush=true operation - operations with --flush=true reset and don't count this commit removes automatic flush from #10971 and instead errors to encourage users of --flush=false to develop a habit of calling 'ipfs files flush' periodically. boxo will no longer auto-flush (ipfs/boxo#1041) to avoid corruption issues, and kubo applies the limit to 'ipfs files' commands instead. closes #10842
tests verify the new Internal.MFSNoFlushLimit config option: - default limit of 256 operations - custom limit configuration - counter reset on flush=true - counter reset on explicit flush command - limit=0 disables the feature - multiple MFS command types count towards limit
This was referenced Sep 23, 2025
Closed
gammazero
approved these changes
Sep 23, 2025
Contributor
gammazero
left a comment
There was a problem hiding this comment.
This looks good, but I think the documentation needs to include an explanation about why operations will fail when the limit is reached, instead of automatically flushing. Otherwise, people will keep asking why or spend time trying to give us PRs that attempt to do that.
addresses feedback from #10985 (review) - clarify that automatic flushing at limit was considered but rejected - explain the data corruption risks of auto-flushing - guide users who want auto-flush to use --flush=true (default) - document benefits of explicit failure for batch operations
- added emoji headers for filestore/urlstore and MFS sections - linked Strategy to config docs - kept both new features from master and current branch
includes filestore and urlstore providing fixes
lidel
added a commit
that referenced
this pull request
Sep 27, 2025
* fix: add MFS operation limit for --flush=false adds a global counter that tracks consecutive MFS operations performed with --flush=false and fails with clear error after limit is reached. this prevents unbounded memory growth while avoiding the data corruption risks of auto-flushing. - adds Internal.MFSNoFlushLimit config - operations fail with actionable error at limit - counter resets on successful flush or any --flush=true operation - operations with --flush=true reset and don't count this commit removes automatic flush from #10971 and instead errors to encourage users of --flush=false to develop a habit of calling 'ipfs files flush' periodically. boxo will no longer auto-flush (ipfs/boxo#1041) to avoid corruption issues, and kubo applies the limit to 'ipfs files' commands instead. closes #10842 * test: add tests for MFSNoFlushLimit tests verify the new Internal.MFSNoFlushLimit config option: - default limit of 256 operations - custom limit configuration - counter reset on flush=true - counter reset on explicit flush command - limit=0 disables the feature - multiple MFS command types count towards limit * docs: explain why MFS operations fail instead of auto-flushing addresses feedback from #10985 (review) - clarify that automatic flushing at limit was considered but rejected - explain the data corruption risks of auto-flushing - guide users who want auto-flush to use --flush=true (default) - document benefits of explicit failure for batch operations (cherry picked from commit a688b7e)
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.
This PR prevents unbounded memory growth while avoiding the data corruption risks of auto-flushing flagged by @hsanjuan
Problem
We need to remove automatic flush from boxo introduced in #10971, it may lead to silent issues that are hard to debug. Instead counts
--flush=falseoperations and errors to encourage users to develop a habit of callingipfs files flushperiodically. Users should have enough intuition to flush at sensible interval/batch, minimizing risks.Solution
Boxo will no longer auto-flush (I'm reverting ipfs/boxo#1037 in ipfs/boxo#1041) to avoid creating surface for more corruption issues. Kubo applies the limit to
ipfs filescommands instead.This PR adds a global counter that tracks consecutive
ipfs filesoperations performed with--flush=falseand fails with clear error after limit is reached.TLDR
Internal.MFSNoFlushLimitconfigipfs files flushor any--flush=trueoperation)Closes #10842