Skip to content

The CONTINUATION+drain e2e test never reaches the mid-frame window its production guarantee protects #1453

Closed

Description

@FlorentinDUBOIS

test_h2_continuation_survives_a_graceful_drain_mid_reassembly writes its CONTINUATION frame in a single TLS write, so it never reaches the window the production code actually protects. Measured: inverting graceful_goaway's reassembly_in_progress to false does not turn the test red, before or after the drain-race fix.

Found while replacing that test's two fixed sleeps with observable gates (on refactor/h2-header-reassembly); disclosed by the implementer rather than discovered later, and deliberately filed separately because closing it changes what the test exercises.

Why the inversion no longer reds it

After the HEADERS+CONTINUATION reassembly extraction, the in-flight header block lives in HeaderBlockAccumulator, not in zero.storage. begin_graceful_drain's DeferInitial decision therefore no longer protects this shape by itself — it protects against serializing a GOAWAY into zero.storage while a block is accumulating there, which is a window the extraction closed by construction.

The surviving window the decision still guards is a CONTINUATION split across TCP segments mid-socket_read. The test writes the whole frame in one call, so it never gets there.

The inversion that does red the test corrupts the accumulated block directly — header_reassembly.append(b"\xff") in graceful_goaway — producing "sozu never completed stream 3's header block", left: Fail / right: Success, in 2.9s. That is a real red, and it proves the test discriminates; it just does not prove the drain decision is what saves it.

Why this matters beyond neatness

reassembly_property (quickcheck) already covers the mid-frame split shape. The e2e test does not, so the only end-to-end evidence for the DeferInitial path is a test that would stay green if that path were removed. An e2e test whose production guarantee can be deleted without it noticing is not covering that guarantee.

Asked for

Split the CONTINUATION across two TLS writes so the e2e test reaches the same mid-frame shape reassembly_property covers, with the drain triggered between them.

The ordering must hold by construction, not by timing. The changeset that found this replaced ANCHOR_DELAY — an ordering requirement expressed as a duration — with DelayedH2Backend::start_held + release(), and the same discipline applies here: a second write that lands "usually after" the drain is the defect this test already had.

Available observables, established by that work:

  • server.live reaching 0 proves the drain landed (Server::run writes the gauge at the loop tail and calls shut_down_sessions() in the same iteration, while command responses are produced earlier in the body — so a query returning 0 was answered no earlier than the next iteration).
  • The h2_frame_rx counter ticking proves a frame was dispatched (handle_frame does count! immediately before dispatching, one synchronous pass).

Red-then-green requirement, with a caveat specific to this test. Its colour has been measured to track load rather than behaviour in its pre-fix form: 3/3 red against correct production at load average 219, and 1/3 green against inverted production at load 27. So "revert the fix and see it red" is not sufficient evidence here. Demonstrate discrimination instead — red under a broken guarantee, green under a correct one, with enough repetitions under load to show the result is not the box being quiet. The prior work used 25 invocations to 0 failures plus a 6-concurrent load harness.

Specifically: after this change, inverting reassembly_in_progress to false must turn the test red. That is the acceptance criterion, and it is exactly what fails today.

Do not

Do not reintroduce a sleep to sequence the two writes. Do not widen the deadline to make the split reliable — the deadline bounds a hang, it does not pace the test.

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