Skip to content

h3: single-worker QUIC migration + HEAD/rejected-stream fixes + tests (#59) - #73

Merged
EdmondDantes merged 6 commits into
mainfrom
59-h3-finish-all
May 31, 2026
Merged

EdmondDantes merged 6 commits into
mainfrom
59-h3-finish-all

Conversation

@EdmondDantes

Copy link
Copy Markdown
Contributor

Remaining HTTP/3 "finish-all" work from the #59 roadmap. Single-worker scope; cross-worker migration is tracked separately in #72.

Commits

  • 27f073c QUIC connection migration / NAT rebinding (RFC 9000 §9). Read path feeds ngtcp2 the datagram's real source; conn->peer re-pointed; drain emits on ps.path (the key PATH_CHALLENGE fix); admit_peer; quic_path_migrations counter; h3client gains H3CLIENT_MIGRATE_AFTER. Test 032.
  • a309ed7 docs(h3). Deployment notes (rmem_max for SO_RCVBUF) + single-worker migration section in the H3 roadmap.
  • ba300f2 HEAD body suppression. http3_stream_submit_response honours HEAD like H1 (status + headers, no body). Tests 033 + 034 (SR-reset size clamps: reject <41, reply clamped to [22,1200]).
  • 0a8cdd7 unit harness. cmocka coverage for the pure http3_packet helpers (SR token/clamp/errno buckets); account_send_error promoted to public http3_packet_account_send_error.
  • 2fcf227 rejected-stream slot leak fix. A stream dispatched then rejected leaked a pool slot (awaitBody hung). Finalize the body on reject. Test 035.
  • 4c751cf tests. setHttp3SocketBufferBytes validation + success-path stats non-zero after a GET.

Verification (local)

  • Build clean.
  • tests/phpt/server/h3: 35/35.
  • tests/phpt/server/h1 + h2: 48/48 (no collateral).

…tats non-zero (#59)

030: setHttp3SocketBufferBytes had zero coverage — default/range/0-accept/locked guard.
031: handshake_completed / h3_init_ok / packets_sent / bytes_sent / datagrams_received
were only ever asserted ==0 (008); drive a GET and assert they actually advance.
Read path feeds the datagram's real source into ngtcp2_conn_read_pkt so a
migrated / NAT-rebound client is detected; conn->peer is re-pointed to ngtcp2's
current path after each read (new quic_path_migrations counter). The drain now
sends each GSO batch to the destination ngtcp2 reports in ps.path (flushing on
path change) so PATH_CHALLENGE reaches the new path — previously it always went
to the stale conn->peer, deadlocking validation. admit_peer keeps per-peer
budget accounting keyed on the admission address across a migration.

h3client gains H3CLIENT_MIGRATE_AFTER=N (rebind to a fresh source port; the old
socket is retired-not-closed to avoid spurious ICMP a real NAT never sends).
Test 032 drives a single-conn migration. Single-worker scope; multi-worker
needs CID-steering (eBPF), tracked separately. h3 suite 32/32.
…igration shipped (#59)

- Deployment section: SO_*BUF needs net.core.{r,w}mem_max raised or the kernel
  clamps it to ~208 KiB → RcvbufErrors under burst; note the reactor throttle fix.
- Migration section: single-worker NAT-rebind migration shipped (27f073c);
  cross-worker steering (CID + eBPF) remains.
- Phase 3 ngtcp2 blocker already recorded (#71).
- http3_stream_submit_response: a HEAD response now omits the body bytes
  (RFC 9110 §9.3.2), mirroring the H1 path which already suppressed it; the H3
  handler path previously emitted the body unconditionally. Test 033.
- Test 034: stateless-reset size boundaries — reject inbound <41 (no reply,
  counter unchanged), reply length = clamp(inbound-1, 22, 1200) incl. the 1200
  ceiling. Complements 013's happy path. h3 suite 34/34.
Relocate the sendmsg-errno bucketing out of the static account_send_error in
http3_listener.c into a public http3_packet_account_send_error in
http3_packet.c (portable errno guards), so it is reachable without the
unlinkable listener TU. New tests/unit/http3/ target (cmocka, guarded by a
QUIC pkg-config probe) drives: stateless-reset token determinism + HMAC oracle,
the reset size gate (refuse <41), and the errno->bucket mapping. One stub
(http3_listener_send_packet). h3 phpt suite green; HTTP3Packet unit 4/4.
…#59)

A request stream rejected AFTER dispatch (e.g. body-size overflow) left its
handler suspended in $request->awaitBody() forever: h3_end_stream_cb skips
finalize on a rejected stream, so the body_event never fired, the coroutine
never disposed, and its stream-pool slot + HttpRequest wrapper leaked
(http3_stream_pool_cleanup live_count!=0 assert in debug; silent slot leak in
release). h3_reject_request_stream now finalizes the request body for a
dispatched stream, waking the waiter so the coroutine completes and releases.
Test 035 (17 MiB POST over a 20 MiB window) is the regression guard; 021
(header-overflow, reject before dispatch) confirms the pre-dispatch path is
unaffected. h3 suite 35/35.
@EdmondDantes
EdmondDantes merged commit 10b48ee into main May 31, 2026
5 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Coverage

Total lines: 81.02% → 81.28% (+0.26 pp)

File Baseline Current Δ Touched
src/http3/http3_callbacks.c 76.63% 79.76% +3.13 pp ●
src/http3/http3_connection.c 81.79% 82.27% +0.48 pp ●
src/http3/http3_io.c 84.86% 89.27% +4.41 pp ●
src/http3/http3_listener.c 74.11% 74.34% +0.23 pp ●
src/http3/http3_packet.c 97.50% 91.21% -6.29 pp ●
src/http_server_class.c 68.17% 68.19% +0.02 pp ●
src/http_server_config.c 94.28% 95.23% +0.95 pp

❌ Regression in touched files (> 1.0 pp drop)

  • src/http3/http3_packet.c dropped -6.29 pp

Add [coverage-drop-ok] to a commit message in this PR to override.

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