Skip to content

disk fill --percent does not sustain target disk usage: one-shot fill leaves permanent headroom once space is reclaimed #1408

Open
chaosblade-io/chaosblade-exec-os
#242

Description

@woyaonidish

Issue Description

Type: bug report

Describe what happened (or what feature you want)

blade create disk fill --path <dir> --percent 100 does not keep the disk at the target usage for the lifetime of the experiment. It performs a one-shot, fixed-size fill and then stops maintaining pressure.

Observed on a 142G volume mounted at /app hosting an application that writes synchronous logs (with log rotation):

  • Usage ramps 4% -> 60% -> 88% -> ~98-100%, then plateaus at ~98% (139G used / ~3.5G available) for the entire fill window (5 minutes), fluctuating only with the write/rotation balance.
  • Application log files keep being written at high speed the whole time; the ~3.5G of headroom is never re-filled.
  • Because free space always remains, synchronous log writes never block, so TPS only dips slightly instead of collapsing.

The fill size is computed once from a single Statfs snapshot at create time (calculateFileSize), written via fallocate/dd, and then startFill returns. There is no loop / ticker / re-stat / top-up anywhere in disk_fill.go. Any space reclaimed after t0 (here: log rotation deleting old logs once the disk touches full) becomes permanent headroom, so the invariant "usage == percent" is violated for the rest of the experiment.

Two secondary sizing defects guarantee additional headroom even without rotation:

  • usedBytes := allBytes - availableBytes uses stat.Bavail, which excludes root-reserved blocks on ext4, so reserved space is miscounted as used and --percent 100 under-fills by ~the reserve fraction; moreover root processes can still write into reserved blocks even when Bavail == 0.
  • The usage/expected percentages are rounded with %.2f (1% quantization), leaving up to ~0.5% of total size as headroom in the round-up case.

Describe what you expected to happen

With --percent 100, the disk should be held at 100% usage for the whole experiment (until blade destroy), so that a synchronous-logging application actually blocks on log writes and TPS drops as expected. More generally, --percent N should maintain usage at N%, re-filling any space reclaimed during the experiment.

How to reproduce it (as minimally and precisely as possible)

  1. Run an application on a dedicated volume (e.g. /app) that continuously writes logs and rotates/deletes old logs.
  2. blade create disk fill --path /app --percent 100
  3. Sample df -h /app every few seconds: usage briefly touches ~100%, then settles below 100% (e.g. 98%) and stays there while logs keep writing; blade destroy drops it back to baseline.

Tell us your environment

  • ChaosBlade / chaosblade-exec-os v1.7.3 and v1.7.5 (reported), and confirmed identical fill logic through v1.8.0 / v1.8.1 / v1.8.2 and current master (81c9880) — this is a design-level defect present in all versions, not a regression.
  • Linux x86_64, LVM volume (ext4/xfs), application runs as root.

Anything else we need to know?

Root-cause code references (master 81c9880, exec/disk/disk_fill.go):

Suggested fix direction: make --percent a sustained fill — a maintainer that periodically re-reads Statfs and tops the fill file back up to the target until destroy; compute the deficit in bytes (no %.2f), using true used (Blocks - Bfree) rather than Blocks - Bavail.

Note: chaosblade-exec-os has GitHub issues disabled, so this user-facing bug is filed in the main chaosblade repo; the fix belongs in chaosblade-exec-os exec/disk/disk_fill.go.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions