-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the |
@konradpabjan @hashtagchris do you mind to take another look? I fixed the unit test. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 🚀
Co-authored-by: Chris Sidi <hashtagchris@github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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-Length
header.