Repository navigation
Retry artifact download when response stream is truncated (continued) - #661
Merged
Merged
Conversation
If we received 200, we will attempt to download the stream. If the stream is gzipped, gzip should throw an error when trying to decompress the stream; or if the stream is truncated, the received bytes should be different from the value set in content-length header.
konradpabjan
reviewed
Dec 3, 2020
konradpabjan
reviewed
Dec 3, 2020
Contributor
Author
|
I tested all the positive cases, not sure how to test the negative case since my download was working fine. I tested with 1GB files. Tested:
Headers: |
konradpabjan
reviewed
Dec 3, 2020
Contributor
Author
Seems like the |
Contributor
Author
|
@konradpabjan @hashtagchris do you mind to take another look? I fixed the unit test. Thanks! |
hashtagchris
reviewed
Dec 3, 2020
hashtagchris
reviewed
Dec 4, 2020
Co-authored-by: Chris Sidi <hashtagchris@github.com>
hashtagchris
approved these changes
Dec 4, 2020
hashtagchris
left a comment
Contributor
There was a problem hiding this comment.
Looks good - thanks for fixing this!
Comment on lines
+315
to
+317
| core.error( | ||
| `An error occurred while attempting to read the response stream` | ||
| ) |
Contributor
There was a problem hiding this comment.
FYI, I was a little worried that calling gunzip.close() would trigger on error below and cause two core.errors to get logged. But I tried adding the following to the mock, and saw only this error block get hit:
case 1:
this.emit("error", new Error("injecting read error"))
break
2 of 3 tasks
Derrick-MUGISHA
pushed a commit
to Derrick-MUGISHA/toolkit
that referenced
this pull request
Oct 12, 2026
Retry artifact download when response stream is truncated (continued)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Continuation of #652
Closes actions/download-artifact#53 and actions/download-artifact#55
We retry when we receive some non success http status code such as 409, 503, etc. However even if we received a 200 success status code but the response stream were interrupted during download, we should also retry.
When we stream down the file, we could stream with gzip compression, and if we do, we rely on gzip processing to detect the stream is corrupted. If the stream is not gzip compressed, we will verify the downloaded file is of the same size specified in
Content-Lengthheader.