Skip to content
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

Fix retry when downloading clang tools #59806

Merged
merged 3 commits into from
Sep 30, 2021

Conversation

jakobbotsch
Copy link
Member

Invoke-WebRequest throws an exception when the download fails, so we
should use try-catch instead of status code to check failure.

In addition pass -PassThru to avoid leaving a corrupted download file in
case the download fails. This will buffer the download and write it once
at the end.

Fix #57196

I used clumsy to verify that this works. In those tests I also noticed that on PowerShell 7, Invoke-WebRequest with -OutFile but without -PassThru sometimes does not detect when the download fails. It seems to work reliably with -PassThru though. There is already an issue for it: PowerShell/PowerShell#16122

Invoke-WebRequest throws an exception when the download fails, so we
should use try-catch instead of status code to check failure.

In addition pass -PassThru to avoid leaving a corrupted download file in
case the download fails. This will buffer the download and write it once
at the end.

Fix dotnet#57196
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Sep 30, 2021
@ghost
Copy link

ghost commented Sep 30, 2021

Tagging subscribers to this area: @JulieLeeMSFT
See info in area-owners.md if you want to be subscribed.

Issue Details

Invoke-WebRequest throws an exception when the download fails, so we
should use try-catch instead of status code to check failure.

In addition pass -PassThru to avoid leaving a corrupted download file in
case the download fails. This will buffer the download and write it once
at the end.

Fix #57196

I used clumsy to verify that this works. In those tests I also noticed that on PowerShell 7, Invoke-WebRequest with -OutFile but without -PassThru sometimes does not detect when the download fails. It seems to work reliably with -PassThru though. There is already an issue for it: PowerShell/PowerShell#16122

Author: jakobbotsch
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@EgorBo
Copy link
Member

EgorBo commented Sep 30, 2021

I wonder if we can easily re-use this function there

@jakobbotsch
Copy link
Member Author

I wonder if we can easily re-use this function there

Good idea! Done.

@jkoritzinsky
Copy link
Member

Thanks for fixing this!

@jakobbotsch jakobbotsch merged commit 5e4bd40 into dotnet:main Sep 30, 2021
@jakobbotsch jakobbotsch deleted the fix-windows-download-tools-retry branch September 30, 2021 17:14
Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatting jobs fails in CI
4 participants