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

オープン 初心者向け
#2,575 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
github, node.js, typescript
領域
backend, devtools

調査の方向性

@actions/artifact パッケージの streamExtractExternal から始めます。issue によると、200 以外の応答がリトライ前に開いたままになっています。応答処理とそのテストを読み、issue で説明されているローカル mock を使って 404-then-200 のケースを再現します。リトライが成功し、ソケットのタイムアウトを待つことなくプロセスが速やかに終了すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Package: @actions/artifact, as bundled in actions/download-artifact@v8.

What happens.

  1. The first GET of the blob URL gets a non-200 answer (seen with 404 and 503).
  2. streamExtractExternal throws without consuming or destroying the response.
  3. The download retries after 5 s, the retry succeeds, and the step logs success.
  4. 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.

主要言語
TypeScript
スター
5.9k
フォーク
1.8k
平均マージ
15分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

actions/toolkit のほかの issue

actions/toolkit の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。