Repository navigation
fix(server,scripts): linger after H2 GOAWAY and flush guard logs - #1664
Merged
Merged
Conversation
Track outbound HTTP/2 error GOAWAY frames (error_code != 0) in ProgressIo so poll_shutdown waits through LINGER_QUIET to drain late-arriving pipelined frames instead of dropping the socket into TCP RST, and reclaim ProgressIo if Hyper exits without shutting down. Resolves the intermittent c-h2-0006/0007 reset failures tracked in #1421 without touching frozen conformance schemas or weakening assertions.
Pass baseline preparation elapsed seconds to guard shard workers so GUARD_BUDGET_STOP fires relative to the full stage budget, fail early if baseline setup exhausts the stop threshold, flush completed worker logs immediately, and add a pre-SIGKILL parent watchdog reporting stalled workers and their last ledger ordinals. Resolves the timeout-diagnostic and budget-clock defects tracked in #1619 and #1465.
This was referenced Nov 27, 2026
This was referenced Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two live reproducible macOS test/guard defects observed on
origin/main(678cb302):crates/server): On678cb302,conn::h2::testsfailed 2/5 runs onc-h2-0007(expected eof, observed reset), and a new deterministic socket test reproducedaccepted=46/74, drained=0. After Hyper flushes an HTTP/2 errorGOAWAY(error_code != 0),ProgressIo::poll_shutdowncould seePoll::Pendingbefore a pipelinedHEADERSframe landed and return immediately (!linger.started && !linger.body_unfinished), closing the socket so arriving bytes triggered TCPRST; any Hyper error path that dropped the transport without callingpoll_shutdownalso skipped lingering close. This PR adds a zero-allocationH2OutboundGoAwayTrackerincrates/server/src/preface.rs, wires it throughProgressIo::poll_write,poll_write_vectored,poll_shutdown, andlinger_on_pendingincrates/server/src/io.rs, and reclaims unshut transports viaReclaimableIoincrates/server/src/conn.rs. HTTP/1.1 traffic, gracefulGOAWAY(NO_ERROR), and connections whose peer already sent EOF do not enter protocol-error linger.scripts/test_guard_scripts.sh): On678cb302, runningbash scripts/test_guard_scripts.shunder load took503.33s(-13sof its480sCI budget left) because shard workers resetSECONDS=0aftermake_sandboxsetup and the parent buffered all worker logs until every worker exited, erasing progress if the outerverify --alltimer sentSIGKILL. This PR validatesGATEWAY_GUARD_BUDGET_ELAPSED, forwardsbaseline_elapsedto workers soGUARD_BUDGET_STOPaccounts for the full stage clock (and stops before spawning workers if baseline setup already exhaustedGUARD_BUDGET_STOP), flushes each worker's log immediately upon exit, and adds aGUARD_BUDGET_SECONDS - 10parent watchdog that prints unfinished workers' last ledger ordinals and partial logs before terminating them.Closes #1421
Closes #1619
Closes #1465
Mutation Proofs
Every new assertion was verified red against targeted mutations before committing:
crates/server, 5/5 red):M-H1-disable-linger-on-error-goaway: disabledlinger_on_pending()returningtrueafter errorGOAWAY->lingering_close::an_http2_protocol_error_with_unread_trailing_frames_ends_in_a_close_and_not_a_resetfailed (rc=101).M-H2-skip-vectored-outbound-observe: skippedobserve_outbound_bytesinpoll_write_vectored->io::tests::h2_error_goaway_via_vectored_write_reclaims_unshut_transportfailed (rc=101).M-H3-treat-no-error-goaway-as-error: markedGOAWAY(NO_ERROR)as protocol-error ->io::tests::n_h2_no_error_goaway_does_not_linger_when_pendingfailed (rc=101).M-H4-drop-is-http2-wire-guard: droppedis_http2_wire()guard inobserve_outbound_bytes->io::tests::n_http1_response_containing_goaway_bytes_never_triggers_h2_lingerfailed (rc=101).M-H5-drop-peer-ended-guard: dropped!self.peer_endedguard inneeds_protocol_error_linger()->io::tests::n_h2_error_goaway_after_peer_eof_does_not_request_reclaim_lingerfailed (rc=101).scripts/test_guard_scripts.sh, 5/5 red in isolated temp copies):M-G1-drop-elapsed-env-validation: bypassed non-negative integer check onGATEWAY_GUARD_BUDGET_ELAPSED->test_guard_budget_diagnostics.pyfailed on invalid-1input (rc=1).M-G2-drop-baseline-elapsed-forwarding: forwardedGATEWAY_GUARD_BUDGET_ELAPSED=0to workers ->test_guard_budget_diagnostics.pyfailed (worker must stop when baseline + worker seconds >= stop,rc=1).M-G3-drop-baseline-precheck: bypassedbaseline_elapsed >= GUARD_BUDGET_STOPcheck ->test_guard_budget_diagnostics.pyfailed (rc=1).M-G4-buffer-worker-output-until-all-done: removed immediate worker log flush on exit ->test_guard_budget_diagnostics.pyfailed (rc=1).M-G5-disable-parent-watchdog: disabledSECONDS >= parent_stopwatchdog -> stalled-worker test timed out as expected.Verification
Four-command gate and targeted checks executed on macOS arm64 (
CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0 CARGO_BUILD_JOBS=4):No CI jobs were added; PR gate wall-clock budget impact is neutral (one 325-line Python guard self-test added as a
shard_case, running in ~2s inside an existing shard worker).Role Verdicts
Breaking Change
Checklist
cargo xtask verify)went red. The PR description names which ones
BREAKINGand a migration pathunsafeintroducedinventory/linkmeintroduced#[non_exhaustive]added to a DTO