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

Đang mở Phù hợp với người mới
#2,575 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
github, node.js, typescript
Lĩnh vực
backend, devtools

Hướng nghiên cứu

Bắt đầu tại streamExtractExternal trong gói @actions/artifact, nơi issue cho biết một phản hồi khác 200 vẫn bị mở trước khi thử lại. Đọc phần xử lý phản hồi và các bài kiểm tra của nó, sau đó tái hiện trường hợp 404-then-200 bằng mock cục bộ được mô tả trong issue. Hoàn thành khi lần thử lại thành công và tiến trình thoát nhanh chóng thay vì chờ hết thời gian chờ của socket.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
5.9k
Fork
1.8k
Merge trung bình
15 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của actions/toolkit

Tất cả issue của actions/toolkit

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.