test: harden http test server lifecycle to fix flaky FormData EPIPE#10820
Merged
jasonsaayman merged 2 commits intov1.xfrom Apr 28, 2026
Merged
test: harden http test server lifecycle to fix flaky FormData EPIPE#10820jasonsaayman merged 2 commits intov1.xfrom
jasonsaayman merged 2 commits intov1.xfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by cubic
Hardened the test HTTP server lifecycle and stabilized flaky cases by using ephemeral ports, graceful shutdown, and one‑shot agents. Also added small retries and ephemeral ports to HTTP/2 session and Safari abort tests to prevent EPIPE and “Premature close” flakes in CI.
Description
startHTTPServerto port 0; use OS-assigned ephemeral ports.stopHTTPServer: try graceful close first; force-close after a short grace; always untrack;handleFormDatanow drains unread request bytes on parse errors.new http.Agent({ keepAlive: false }),Connection: 'close', destroy agent infinally, and{ retry: 2 }.{ retry: 2 }, and set{ timeout: 15000 }where needed.{ retry: 2 }for the ETIMEDOUT case.Docs
/docs/on using ephemeral ports for test servers, preferring graceful shutdown before force-closing, draining unread request bodies, using non‑keep‑alive agents for one‑shot requests, and applying small retries for timing‑sensitive tests (e.g., HTTP/2 sessions, Safari abort scenarios).Testing
Semantic version impact
Written for commit 977ae5a. Summary will update on new commits. Review in cubic