Skip to content

cache: concurrent eviction returns CacheFull with memory free #69

Closed

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.

  • With evict_victims_concurrently on, which is the production default (src/core/src/cache/builders.rs:64 sets !cfg!(test)), evict_victims collects every victim's result and propagates the first Err with ? (core.rs:829-835).
  • One victim failing its disk reservation fails the whole insert, even when the other victims already freed enough memory.
  • The inferred mechanism: concurrent victims reserve all the disk, and a later victim finds no disk victim to evict because no record has been installed yet.

Evidence.

  • An insert was refused with memory at 5,984 + 352 = 6,336 bytes, under the 7,040-byte limit. The same insert succeeded under sequential eviction.
  • Under production defaults, the first failure came at 34,840 of 51,456 bytes used.
  • Every refused insert also strands victims (cache: failed or cancelled eviction strands its victims #66).

Tests.

Test File Command Flags
audit_an_insert_that_fits_in_memory_is_not_refused_as_cache_full src/core/src/cache/core.rs:3752 cargo +1.96.0 test -p liquid-cache --lib audit_an_insert_that_fits_in_memory_is_not_refused_as_cache_full -- --nocapture
audit_prod_failed_insert_strands_victims_small_disk_concurrent (also under #66) src/core/src/cache/core.rs:2834 cargo +1.96.0 test -p liquid-cache --lib audit_prod_failed_insert_strands_victims_small_disk_concurrent -- --nocapture

Not inline: the test needs the branch's audit_insert_over_small_disk and audit_cache helpers. Related: #43 notes that no test covers the concurrent path.

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

  1. added
    bugSomething isn't working
    performanceWasted work, over-eviction or excess IO
    on Nov 17, 2026
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 workingperformanceWasted work, over-eviction or excess IO

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions