Skip to content

tests: http2's closed-stream rules are pinned for resets, forgotten streams and skipped ids (#640), and the zero-memlock accept test skips where the kernel registers the ring anyway - #651

Merged
MDA2AV merged 2 commits into
mainfrom
tests/640-closed-streams
Nov 21, 2026

Conversation

@MDA2AV

@MDA2AV MDA2AV commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #648: seven Unit tests in Http2ClosedStreamTests for frames on a stream that is no longer open, cases the connection handled without a test. No source change.

  • DATA after the peer reset a stream it had already ended, its answer still parked: GOAWAY(STREAM_CLOSED), and the next stream is not served. RFC 7540 5.1 makes a frame after END_STREAM a connection error and one after RST_STREAM a stream error; both happened here, and the connection takes the first. The test pins that choice. If a stream reset is wanted instead, that is a change to the connection, and this is the test to flip.
  • HEADERS after the peer's RST_STREAM on a request still arriving: RST_STREAM(STREAM_CLOSED), and the block is decoded, so the next request resolves the field it inserted.
  • HEADERS on a stream the peer ended more streams ago than the ring remembers: dropped and decoded, and the connection goes on.
  • HEADERS on stream 3 or 5, skipped when the client opened 7 after 1: GOAWAY(PROTOCOL_ERROR), while trailers on 7, answered early and reset, are dropped.
  • More skips than the connection remembers: HEADERS on the oldest are dropped and decoded; on one still remembered they end the connection.
  • A stream refused past MaxConcurrentStreams counts as opened: HEADERS on an id it skipped end the connection.

Seen failing. Against main before #648 (3984529) six fail, "expected [GOAWAY 1 0x5], got []" and the like. The forgotten-stream test passes there and fails against #648's first commit (215f19a), which ended the connection for it: "expected [], got [GOAWAY 263 0x1]".

Suites. Unit 397/0/0, E2E 799/0/1 (the skip is a kTLS case: no tls module here).

Second commit: the zero-memlock accept test. core: incremental accept whose buffer ring the kernel refuses sheds, reactor survives failed on every x64 job that ran on GitHub's ubuntu-26.04 image 20261116.202 (kernel 7.0.0-1020-azure), 4 of 4 on 2026-11-20, main's included. That kernel registered the connection's buffer ring at a zero RLIMIT_MEMLOCK, so the accept was served and the test failed on its own precondition ("its ring was never refused and nothing was tested"). The image before it, 20261111.196 (7.0.0-1019-azure), refused the ring.

RegistersRingAtZeroMemlock now asks the kernel first, the way the accept does: a 4-entry IOU_PBUF_RING_INC ring on its own page, registered under a zero soft limit, then the limit put back and the ring unregistered. The test skips when that registration succeeds, beside its skips for a kernel before 6.12 and for CAP_IPC_LOCK. Here (6.14) the kernel refuses, and the test still runs and passes. On this PR's CI it ran both ways: x64 on 20261111.196 and arm64 (ubuntu-24.04-arm) ran it and passed, and the x64 re-run on 20261116.202 skipped it, with every suite green (E2E 789/0/11).

…TREAM, HEADERS after a reset, streams the ring forgot and skipped ids (#640)

Seven Unit tests in Http2ClosedStreamTests for frames on a stream that is no longer open, cases the
connection handled without a test:

- DATA after the peer reset a stream it had already ended, its answer still parked, ends the
  connection with STREAM_CLOSED and the next stream is not served. The END_STREAM came first, and
  RFC 7540 5.1 makes a frame after one a connection error, whatever the peer sent between.
- HEADERS after the peer's RST_STREAM on a request still arriving reset the stream with
  STREAM_CLOSED, and their block is decoded, so the next request resolves the field it inserted.
- HEADERS on a stream the peer ended more streams ago than the ring remembers are dropped and
  decoded, and the connection goes on.
- HEADERS on stream 3 or 5, skipped when the client opened 7 after 1, end the connection with
  PROTOCOL_ERROR, while trailers on 7, answered early and reset, are dropped.
- With more skips than the connection remembers, HEADERS on the oldest are dropped and decoded,
  and on one still remembered end the connection.
- A stream refused past MaxConcurrentStreams counts as opened: HEADERS on an id it skipped end the
  connection.

Confirmed both ways: each passes on main and fails on code without what it pins. Against main
before #648 (3984529) six fail, "expected [GOAWAY 1 0x5], got []" and the like; the forgotten
stream passes there and fails against #648's first commit (215f19a), which ended the connection
for it, "expected [], got [GOAWAY 263 0x1]".

Unit 397, none failing.
…rnel that registers the ring at a zero limit, as GitHub's ubuntu-26.04 runners now do

"core: incremental accept whose buffer ring the kernel refuses sheds, reactor survives" sets the
process's RLIMIT_MEMLOCK soft limit to 0 and expects the next accept's IORING_REGISTER_PBUF_RING to
fail with ENOMEM. On GitHub's ubuntu-26.04 image 20261116.202 (kernel 7.0.0-1020-azure) the kernel
registered the ring, the connection was served, and the test failed on its own precondition ("its
ring was never refused and nothing was tested") on every x64 job that ran there, 4 of 4 on
2026-11-20, main's included. The image before it, 20261111.196 (7.0.0-1019-azure), refused the ring
and the test passed.

RegistersRingAtZeroMemlock asks the kernel first, the way the accept does: a 4-entry
IOU_PBUF_RING_INC ring on its own page, registered under a zero soft limit, then the limit put back
and the ring unregistered. The test skips when that registration succeeds, beside its skips for a
kernel before 6.12 and for CAP_IPC_LOCK. A kernel that refuses the ring still runs it.
@MDA2AV MDA2AV changed the title tests: http2's closed-stream rules are pinned for a reset after END_STREAM, HEADERS after a reset, streams the ring forgot and skipped ids (#640) tests: http2's closed-stream rules are pinned for resets, forgotten streams and skipped ids (#640), and the zero-memlock accept test skips where the kernel registers the ring anyway Nov 20, 2026
@MDA2AV
MDA2AV merged commit 48a630d into main Nov 21, 2026
4 checks passed
@MDA2AV
MDA2AV deleted the tests/640-closed-streams branch November 21, 2026 18:12
@MDA2AV MDA2AV mentioned this pull request Nov 22, 2026
MDA2AV added a commit that referenced this pull request Nov 22, 2026
All twelve csproj Version elements, 0.27.637 to 0.28.652. Carries the 7 PRs from #645 to #651. Package validation against 0.27.637, in strict mode, finds no API change in any of the eleven published packages.

Suites on this tree: Unit 397, E2E 799 (1 kTLS skip), Http 113, Chaos 105, File 14, Tls 217 (41 kTLS skips, no tls module here), Pg 10 (19 skipped, no server here), Redis 1 (7 skipped and 1 pending, no server here).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant