Skip to content

Destroy requests after socket timeout - #2551

Open
dajudge wants to merge 1 commit into
actions:mainfrom
dajudge:fix/http-client-destroy-timed-out-request
Open

dajudge wants to merge 1 commit into
actions:mainfrom
dajudge:fix/http-client-destroy-timed-out-request

Conversation

@dajudge

@dajudge dajudge commented Oct 20, 2026 •

Copy link
Copy Markdown

Description

Fix a socket leak in @actions/http-client when a request times out.

The timeout handler previously called socket.end(). If the remote peer kept its side of the connection open, the client socket could remain half-open and keep the Node.js event loop alive after the request failed.

Destroy the request with the timeout error instead. This closes the underlying socket and preserves the same timeout error returned to callers.

This affects at least actions/setup-java and actions/setup-node; both have required downstream fork/workaround work. Fixing the shared HTTP client removes the need for each consumer to carry its own patch.

Tests

Add a regression test using a half-open TCP server. It verifies that, after a timed-out request, no active client socket remains.

Validation

  • Prettier check
  • ESLint
  • TypeScript build
  • 76 @actions/http-client tests

This patch was developed with assistance from GPT-5.6-Sol.

This branch has not been deployed

No deployments
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