Skip to content

fix(mfs): add soft limit for --flush=false#10985

Merged
lidel merged 5 commits intomasterfrom
fix/mfs-noflush-operation-limit
Sep 25, 2025
Merged

fix(mfs): add soft limit for --flush=false#10985
lidel merged 5 commits intomasterfrom
fix/mfs-noflush-operation-limit

Conversation

@lidel
Copy link
Member

@lidel lidel commented Sep 23, 2025

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=false operations and errors to encourage users to develop a habit of calling ipfs files flush periodically. 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 files commands instead.

This PR adds a global counter that tracks consecutive ipfs files operations performed with --flush=false and fails with clear error after limit is reached.

TLDR

  • adds Internal.MFSNoFlushLimit config
  • operations fail with actionable error at limit
  • counter resets on successful flush (ipfs files flush or any --flush=true operation)

Closes #10842

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
@lidel lidel requested a review from hsanjuan September 23, 2025 01:05
@lidel lidel marked this pull request as ready for review September 23, 2025 01:14
@lidel lidel requested a review from a team as a code owner September 23, 2025 01:14
@lidel lidel mentioned this pull request Sep 23, 2025
3 tasks
Copy link
Contributor

@gammazero gammazero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 lidel merged commit a688b7e into master Sep 25, 2025
16 checks passed
@lidel lidel deleted the fix/mfs-noflush-operation-limit branch September 25, 2025 23:25
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MFS bug: ipfs files rm hanging

2 participants