Skip to content

h2 stream: the HTTP/2 deadlines and waits are stamped from internal/mono, which is still the wall clock: no value changes (Refs #1178) - #1186

Merged
FumingPower3925 merged 2 commits into
mainfrom
mono/1178-step5-push
Oct 31, 2026
Merged

FumingPower3925 merged 2 commits into
mainfrom
mono/1178-step5-push

Conversation

@FumingPower3925

Copy link
Copy Markdown
Contributor

Refs #1178

Step 5 of the route-then-flip plan. Value-neutral: mono.Now() is still the wall clock. Stacked on main b90c1cb (#1185 merged).

What changes

Verified

Draft: not marked ready, not merged.

…ono, which is still the wall clock: no value changes (Refs #1178)

Step 5 of the route-then-flip plan of #1178. The request deadline
(ArmRequest), the header-block deadline, the write-stall records and the
stage 3 waiter records and their judge (write_wait.go) take their stamps from
mono.Now(); the waiters' timers are made of mono.Until(end), which replaces
time.Until(time.Unix(0, end)): that read the WALL clock against a stamp of
the loop's clock. The engines' loop-stuck stamps (LoopSlot.Enter) and the
sweep's now, which the judge compares with its own reading, were routed with
the engines. The fixtures of the stream and conn H2 sweep tests write
mono.Now(). mono.Now() is the wall clock until the flip, so nothing changes.

With this step every stamp of the component is routed but the one pending
entry (Context.StartTime's time.Unix, the flip PR's), and the whole of
internal/conn and internal/protocol/h2/stream passes with the clock skewed by
+1 h and -1 h.
@FumingPower3925 FumingPower3925 added this to the v1.6.0 milestone Oct 31, 2026
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@FumingPower3925

Copy link
Copy Markdown
Contributor Author

Verification, docker linux/arm64 --cpus 2, one container, seccomp unconfined, memlock 8 MiB:

Benchmarks, main (b90c1cb) vs this PR (380eee5), ./internal/protocol/h2/stream, -benchtime 1s -count 3 -cpu 2, order this PR, main, this PR, main, medians of 6:

benchmark main this PR
OneByteGrant911/64KiB 66.9 65.4
OneByteGrant911/1MiB 66.2 70.4
OneByteGrant911/4MiB 57.7 63.7
PoolDispatch 598.8 597.6
StreamAcquireRelease904 40.1 41.9
OneByteGrantWriteDeadline889/off 64.6 73.1
OneByteGrantWriteDeadline889/on 64.2 74.2

(ns/op; geometric mean +6.6%.) These are sub-100 ns benchmarks with 171 to 199 B/op on a busy shared host: the same binary varies by 40% between runs (OneByteGrant911/4MiB: this PR 46.9 to 78.8 ns, main 49.7 to 70.0 ns), and the /off row, where no write deadline exists and the clock is never read, shows the same +13% as /on, so the difference is not the clock. A stall record reads the clock once when a window begins (noteBuffered, beginWait, judgeWait), +0.5 ns routed.

@codecov

codecov Bot commented Oct 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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