Skip to content

[Kestrel] Deflake HTTP/2 connection closing tests - #67789

Merged
halter73 merged 1 commit into
mainfrom
halter73-deflake-http2-closing-tests
Jul 21, 2026
Merged

halter73 merged 1 commit into
mainfrom
halter73-deflake-http2-closing-tests

Conversation

@halter73

Copy link
Copy Markdown
Member

Summary

  • wait for the initial request to reach the application before directly initiating graceful shutdown or closing the HTTP/2 connection
  • make the active-stream and GOAWAY expectations deterministic in all three affected lifecycle tests
  • keep the fix local to these tests instead of changing shared scheduling behavior

StartStreamAsync guarantees that the HEADERS frame was flushed, but not that the connection loop has processed it. A direct StopProcessingNextRequest or OnInputOrOutputCompleted call can therefore observe zero active streams and take a different shutdown path.

Tests

The three affected tests passed 100 iterations each (300 executions).

Related

Wait until the initial request reaches the application before directly initiating graceful shutdown or closing the connection. This guarantees the stream state assumed by each test has been established instead of relying on a transport flush.

Failed CI: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1507529&view=ms.vss-test-web.build-test-results-tab&runId=41548186&resultId=110922&paneView=debug

Refs #39479 and #41172.

Co-authored-by: Copilot App <[email protected]>
Copilot AI review requested due to automatic review settings July 14, 2026 19:10
@halter73
halter73 requested a review from BrennanConroy as a code owner July 14, 2026 19:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR deflakes three Kestrel in-memory HTTP/2 lifecycle tests by ensuring the first request is actually dispatched to the application before triggering connection shutdown/close paths that depend on active-stream state.

Changes:

  • Wrap the test application delegate to signal when a request has entered the app pipeline.
  • Await that signal after StartStreamAsync(...) and before invoking StopProcessingNextRequest(...) / OnInputOrOutputCompleted().
  • Make GOAWAY/active-stream expectations deterministic in the affected tests without changing shared scheduling behavior.
Show a summary per file
File Description
src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs Adds a per-test “request started” synchronization point to stabilize shutdown/GOAWAY assertions in three HTTP/2 connection closing tests.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@gfoidl gfoidl added feature-kestrel area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions labels Jul 15, 2026
@halter73
halter73 merged commit 5d6b575 into main Jul 21, 2026
39 of 41 checks passed
@halter73
halter73 deleted the halter73-deflake-http2-closing-tests branch July 21, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-kestrel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants