Skip to content

Send RST_STREAM ahead of queued frames in the random write scheduler - #1

Open
pagpeter wants to merge 1 commit into
masterfrom
http2-rst-stream-priority
Open

pagpeter wants to merge 1 commit into
masterfrom
http2-rst-stream-priority

Conversation

@pagpeter

Copy link
Copy Markdown
Owner

The random write scheduler, the default for both HTTP/2 servers (http2.Server and the one bundled in h2_bundle.go), queued an RST_STREAM behind the DATA frames already waiting on that stream. If the peer stops reading, those DATA frames wait for flow control that never comes, and the RST_STREAM that would end the stream waits behind them, so the stream can never be reset.

This ports golang.org/x/net/http2 04296fa8 (CL 367154, golang/go#49741): RST_STREAM frames go into the control-frame queue. The http2 change, including its tests, is that commit unchanged; h2_bundle.go gets the same change.

Tests:

  • TestRandomScheduler and TestFrameWriteRequestWithData in http2 are from the x/net commit.
  • TestBundledRandomSchedulerRSTStreamFirst covers the bundled copy, which has no scheduler tests of its own.

TestRandomScheduler and the bundled test fail on master and pass here. go test ./... passes; the scheduler tests also pass with -race.

🤖 Generated with Claude Code

The random write scheduler, which both HTTP/2 servers use by default,
queued RST_STREAM frames behind the stream's DATA frames. A stream whose
peer stopped reading could then never be reset: the RST_STREAM waited for
flow control that would not come.

Port golang.org/x/net/http2 04296fa8 (CL 367154, golang/go#49741) to
http2 and to the bundled server in h2_bundle.go: RST_STREAM frames are
queued with the control frames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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