Skip to content

cache: a full volume panics in write_batch_to_disk #94

Open

Description

@zfarrell

Found by a memory-accounting audit of 8b3c813. The tests are on branch audit/memory-tests and fail on main today; check out that branch to run them. File and line links point at that commit.

What goes wrong. write_batch_to_disk calls .expect("write failed") on store.put (src/core/src/cache/core.rs:1096-1099). When the real volume fills before the budget does (see #88 and #93), inserts panic instead of returning CacheFull, and every later insert that spills panics too.

Evidence.

  • On a 16 MiB tmpfs: 243 successful inserts, then a panic with "short write: expected 69632, got 57344", then StorageFull.
  • On a 32 MiB ext4 volume: a panic at insert 372.
  • No Err(CacheFull) was ever returned, and the disk budget was 1 GiB.

Tests.

Test File Command Flags
audit_full_volume_returns_cache_full_not_panic src/core/src/cache/core.rs:4212 dev/audit/run-in-container.sh vol-tmpfs (or vol-loop, which needs --privileged). Without Docker: sudo mount -t tmpfs -o size=16m tmpfs /small && AUDIT_SMALL_DIR=/small cargo +1.96.0 test -p liquid-cache --lib audit_full_volume_returns_cache_full_not_panic -- --nocapture --test-threads=1 L, D; needs seccomp unconfined for io_uring under Docker

Not inline: it is 123 lines. This is a crash rather than a memory-accounting bug.

Flags: P probabilistic (a pass after a fix only means the race wasn't hit), F interleaving forced by a test hook, L Linux only, D needs Docker, M measurement only, C control (passes by design).

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions