Skip to content

vfs/config: write_buffer memory limits are validated but bound nothing — dirty ranges are unbounded #205

Closed

Description

@scttfrdmn

internal/config.WriteBufferConfig declares three resource limits that reach no consumer:

field declared defaulted validated read by a consumer
write_buffer.flush_interval config.go:129 :506 (30s) :1195 no
write_buffer.max_buffers config.go:130 :507 (1000) — no
write_buffer.max_memory config.go:131 :508 ("512MB") :1113 no

Worse than the usual inert-setting case, because these are validated. max_memory is parsed and range-checked at :1113, so a user who writes max_memory: 2GB gets it accepted, confirmed by validation, and then ignored. Validation is the strongest signal a config system can send that a setting is real.

How they got stranded, which decides the fix: v0.10.1 replaced the contiguous write buffer with internal/vfs dirty-range tracking. The old WriteBuffer these fields configured is gone; the new write path has its own memory behavior and no equivalent knob. So this is not "wire the field to the old consumer" — the consumer no longer exists, and the question is what bounds the new path.

That question is worth answering rather than deleting the fields: internal/vfs dirty ranges are currently unbounded. A process writing sparse ranges across many files accumulates dirty state with no cap and no backpressure, which on a filesystem is how a mount takes the machine down rather than returning ENOSPC. max_memory is the setting that should bound it.

Do:

  1. Establish what bounds dirty-range memory in internal/vfs, and what happens at the bound — flush early, block the writer, or ENOSPC. That is a semantics decision, not a plumbing one.
  2. Wire max_memory to it, and flush_interval to whatever periodic flush the new path has (or should have — writeback with no timer means data sits dirty indefinitely on an idle file).
  3. max_buffers may have no meaning in a range-based design; if so, delete it rather than inventing one, and say why in the changelog since it is a documented key.

Verification: write past max_memory and assert the configured behavior happens — measured against actual process RSS or the vfs's own accounting, not a counter the test also computes. Related: #193 (harness memory footprint) is the test-side of the same unboundedness.

Activity

  1. added
    type: bug
    priority: high
    area: core
    area: buffer
    area: config
    on Aug 2, 2026
  2. added
    effort: medium
    on Aug 3, 2026
  3. scttfrdmn commented on Aug 3, 2026

    @scttfrdmn
    OwnerAuthor

    Confirmed live and first in v0.11.0's write-path phase.

    write_buffer.max_memory is declared (internal/config/config.go:131), defaulted to "512MB" (:508), and validated as a size string (:1113) — and grep -rn MaxMemory --include='*.go' . | grep -v _test.go returns only those three config.go lines. Nothing in internal/vfs reads it, and there is no MaxDirty/MaxBufferSize equivalent either.

    So the v0.10.3 dirty-range write path buffers without any bound: a large sparse write pattern grows the interval map until flush with nothing to stop it, while the configuration reports a 512MB limit. This is the same shape as the defects the v0.10.x releases were spent on — a value that claims a property no code enforces — and it is on the write path, so it goes before the cosmetic config fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: bufferarea: configarea: coreeffort: mediumpriority: hightype: bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions