Uh oh!
There was an error while loading. Please reload this page.
Retry artifact download when response stream is truncated (continued) - #661
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
yacaovsnc
commented
Dec 3, 2020
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: |
yacaovsnc
commented
Dec 3, 2020
Seems like the |
yacaovsnc
commented
Dec 3, 2020
@konradpabjan@hashtagchris do you mind to take another look? I fixed the unit test. Thanks! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Chris Sidi <hashtagchris@github.com>
hashtagchris
left a comment
There was a problem hiding this comment.
Looks good - thanks for fixing this!
| core.error( | ||
| `An error occurred while attempting to read the response stream` | ||
| ) |
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

Continuation of #652
Closesactions/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.