Skip to content

Flaky test: read_ahead_under_a_stalled_writer_shrinks_with_the_queue_memory_budget #809

Description

@nh13

Summary

test_pipeline_memory_backpressure::read_ahead_under_a_stalled_writer_shrinks_with_the_queue_memory_budget (in tests/integration/test_pipeline_memory_backpressure.rs) is intermittently failing. It failed 1 of 3 local reps and has failed in CI, independent of any particular change (it reproduces on main).

Symptom

read-ahead was 3169724 bytes under a 2097152-byte budget and 4578134 bytes under a 4194304-byte one; the gap is smaller than one tight budget, so the budget is not bounding the queues

The tight-budget arm is stable (~3169724 bytes across runs); the generous-budget arm varies with scheduler timing (observed 4578134 and 4929843 bytes). When the generous arm reads less far ahead, the tight-vs-generous gap dips below the assertion threshold:

assert!(
    generous.saturating_sub(tight) >= TEST_BUDGET_BYTES, // TEST_BUDGET_BYTES = 2 MiB
    ...
);

Why it's flaky

The assertion requires the read-ahead gap between the two budgets to span at least one tight budget (2 MiB). How far the reader runs ahead of a stalled writer depends on scheduler timing and block boundaries, so the generous arm's read-ahead is not deterministic. On a slow/contended run it can land close enough to the tight arm that the gap falls under 2 MiB even though the budget IS bounding the queues.

Suggested fix

Stabilize the discriminating assertion so it tolerates scheduler jitter without weakening what it proves, e.g.:

  • average each arm's read-ahead over a few reps before comparing, or
  • tie the required gap margin to the observed rep-to-rep variance rather than a fixed 2 MiB, or
  • assert a proportional relationship (generous meaningfully exceeds tight) with a margin sized from measured spread.

Notes

Surfaced while rebasing #772 onto main; the PR does not touch this test or the BAM pipeline code it exercises.

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