@actions/artifact: a non-200 blob response is not destroyed before the retry, so the process waits for the 3-min socket timeout
Package: @actions/artifact, as bundled in actions/download-artifact@v8.
What happens.
- The first GET of the blob URL gets a non-200 answer (seen with 404 and 503).
streamExtractExternalthrows without consuming or destroying the response.- The download retries after 5 s, the retry succeeds, and the step logs success.
- The first response's socket stays open.
@actions/http-client's default request timeout (req.setTimeout(3 * 60000)) then keeps node alive until it fires, so the step ends about 180 s after the blob request instead of at once.
Reproducer. We used a local mock of the artifact API whose blob URL answers 404 (or 503) once, then 200. We ran download-artifact@v8's dist/index.js with GITHUB_API_URL pointed at the mock:
- With the one error, it logs
Failed to download artifact after 1 retries due to Unexpected HTTP response from blob storage: 404 Not Found, then success, and exits at 180.3 s. - With a clean 200, it exits in 0.2 s.
No proxy is involved.
In real runs (self-hosted Linux runners, 181 download steps over 40 workflow runs): the step ran past 60 s 5 times. Each time it ended 181.4 s after its "Redirecting to blob download url" line, and the download itself took about 7.7 s (one failed GET, the 5 s wait, a 1.6 s retry).
Suggested fix. In streamExtractExternal, destroy response.message (or read it to the end) before throwing on a non-200 status, so the failed attempt's socket is released.
Workaround on our side: a 1-min step timeout on the download, then a second try.
Disclosure: written by an AI agent (Claude) working for a Longeye engineer; a human reviewed it before posting.
We hit the same thing on GitHub-hosted ubuntu-latest runners (no proxy, no self-hosted network), with actions/download-artifact@v8 (v8.0.2, bundling @actions/artifact 6.3.1, Node 24), same-run downloads with the default runtime token, pattern: + path:, 3 to 4 artifacts of about 3 KB.
What our logs show. The step logs Download artifact has finished successfully, all files are on disk with matching digests, then the step sits silent until timeout-minutes kills it. In every hung attempt we pulled (5 attempts across 3 jobs, Nov 16 to Nov 18), exactly one artifact took about 5.1 s while its siblings took about 0.15 s. That is the 5 s sleep in streamExtract's retry loop; the failed attempt is only logged at debug level, so without ACTIONS_STEP_DEBUG the only trace is the gap:
20:10:15.3426 Starting download of artifact to: .../backend-integration-receipt-3
20:10:15.4707 Artifact download completed successfully.
20:10:15.5188 Artifact download completed successfully.
20:10:20.6650 Artifact download completed successfully. <- +5.1 s
20:10:20.6655 Download artifact has finished successfully
20:12:14.6346 ##[error]The action 'Download shard receipts' has timed out after 2 minutes.
With a 3 min step bound, the step was killed at 16:04:30, 179 s after its blob requests started at 16:01:31: just before the 180 s req.setTimeout in @actions/http-client would have released the socket. An immediate identical retry step hung the same way in both jobs where we had one, on the same artifact.
Independent repro (Node 24.22.1, the v8.0.2 dist/index.js unmodified). A local mock of the artifact API whose blob URL answers 503 once per artifact (small body, server keeps idle connections open like a blob store does), then 200:
| bundle | blob mock | n | result |
|---|---|---|---|
| v8.0.2 as shipped | 200 | 1 | exits in 0.2 s |
| v8.0.2 as shipped | 503 once, then 200 | 5 | still alive 20 s after "finished" in 5/5; unwatched run exited at 180.2 s |
v8.0.2 + response.message.destroy() before the non-200 throw |
503 once, then 200 | 5 | exits in 5.15 to 5.39 s (the retry sleep) |
process._getActiveHandles() 20 s after "finished" shows one Socket per failed attempt: destroyed=false, bytesRead=264 (exactly the 503 response), timeout=180000, _httpMessage still attached. The request went out with Connection: keep-alive (http-client's agent has keepAlive: false but a finite maxSockets: 100, and Node only sends Connection: close when maxSockets is infinite), so the server keeps the connection open, and because the unread IncomingMessage never emits end, Node never frees or destroys the socket.
A 30-iteration loop of the unmodified bundle against real artifacts in our repo (from a laptop, run-id + github-token path) never hung: median 1.57 s, max 4.77 s, no retries. It needs the first blob GET to fail, which we can't force against the real service.
Fix. The one-line change suggested above works: destroy (or drain) response.message before throwing on a non-200 status in streamExtractExternal. Happy to open the PR with a test if that helps.