Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

artifact: release the socket of a non-200 blob response before retrying (#2575) - #2581

Open
HipHoff wants to merge 1 commit into
actions:mainfrom
HipHoff:fix/artifact-destroy-non200-response
Open

HipHoff wants to merge 1 commit into
actions:mainfrom
HipHoff:fix/artifact-destroy-non200-response

Conversation

@HipHoff

@HipHoff HipHoff commented Nov 19, 2026

Copy link
Copy Markdown

Disclosure: this PR was authored by Claude (Anthropic's AI assistant, via Claude Code) on behalf of @HipHoff, who reviewed and takes responsibility for the change.

Root cause

streamExtractExternal throws on a non-200 blob response without reading or destroying response.message. The unread response keeps its keep-alive socket referenced until the http-client request timeout (180 s), so the Node process cannot exit even after the caller's retry succeeds. The fix destroys the response before throwing.

Verified against download-artifact v8.0.2's bundle on Node 24.22.1: with a mock that returns 503 once, the process exits in about 5.2 s (n=5) instead of staying alive past "finished" (5/5 runs).

Test

Adds should destroy the response when blob storage returns a non-200 status to the streamExtractExternal block in packages/artifact/__tests__/download-artifact.test.ts. It follows that file's existing HttpClient mock convention, returns a 503 IncomingMessage, spies on destroy, and asserts it is called once and the existing error is still thrown. It fails without the fix (destroy called 0 times) and passes with it.

Local results

  • npm test -- packages/artifact: 12 suites, 167 tests passed.
  • eslint and prettier --check on the two changed files: clean.

Fixes #2575

@HipHoff
HipHoff requested a review from a team as a code owner November 19, 2026 23:36
aepifano-square added a commit to block/buzz-app that referenced this pull request Nov 23, 2026
## Why

An [upstream bug](actions/toolkit#2575) can
keep the artifact-download action alive for **about three minutes even
after the download succeeds**: a failed request leaves an open
connection behind after a successful retry.

## What changes

Cap native-fixture downloads at **one minute** in browser and
flake-check jobs. After a timeout, continue only if the action reported
a completed download and the fixture passes the existing revision,
checksum and executable checks. Missing, incomplete or corrupt downloads
still fail CI.

This cuts an affected download step from **~3 minutes to ~1 minute**,
avoiding roughly **two minutes of unnecessary waiting**. Total CI
benefits when that delay holds up the last required job; unaffected
downloads finish normally.

**Tradeoff:** the minute includes transfer time, so a legitimate
download taking longer will fail. The 99 recorded downloads without the
hang took 1–24 seconds.

**Temporary:** remove the timeout and completion guard once our pinned
official action includes [the upstream
fix](actions/toolkit#2581); keep fixture
integrity checks.

## Validation

[Full CI
passed](https://github.com/block/buzz-app/actions/runs/45261204669),
including all 29 browser jobs. A [hosted
test](https://github.com/block/buzz-app/actions/runs/45260421944)
confirmed that a simulated post-success hang proceeds after ~60 seconds,
while missing and corrupt artifacts fail. All 36 local workflow checks
passed.

Signed-off-by: Alex Epifano <aepifano@squareup.com>
Co-authored-by: github-enterprise-admin <5016e041c0895516b8c714b80ede89b8a4007c6083dd8737dce174359fde12b5@buzz.block.builderlab.xyz>

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.

@actions/artifact: a non-200 blob response is not destroyed before the retry, so the process waits for the 3-min socket timeout

1 participant