Force-close lingering connections in request test teardown#314657
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Addresses a Linux CI flake in the Request electron-main tests where the /noreply endpoint can leave server-side sockets open, causing server.close() in teardown to hang until the Mocha hook timeout.
Changes:
- Force-close any lingering HTTP connections in test teardown via
server.closeAllConnections()before awaitingserver.close().
Show a summary per file
| File | Description |
|---|---|
| src/vs/base/parts/request/test/electron-main/request.test.ts | Ensures the test server teardown can’t hang on lingering sockets created by /noreply requests. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
Contributor
Screenshot ChangesBase: Changed (12) |
isidorn
approved these changes
May 6, 2026
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
Fixes a flaky
Timeout of 30000ms exceededfailure in the"after each" hook for "cancel"ofvs/base/parts/request/test/electron-main/request.test, observed on Linux CI.The
cancelandtimeouttests open a request to a/noreplyendpoint that the test server intentionally never responds to. After the client aborts/times out, the server-side socket can remain open when teardown runs, causingserver.close()to wait until all connections drain — which never happens, and the hook hits the 30s mocha timeout.Calling
server.closeAllConnections()(Node 18.2+) beforeserver.close()destroys those lingering sockets soclose()resolves promptly.Session Context
after eachhook forcancel, not the test body.server.close()keeps existing connections alive by design, so any socket from/noreplythat hasn't fully torn down on the server side blocks teardown until the mocha timeout.requestimplementation is unaffected.closeAllConnections(): Available since Node 18.2 (well within VS Code's supported range) and is the documented way to force in-flight server-side sockets closed.