-
Notifications
You must be signed in to change notification settings - Fork 288
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
Add a "status" API to DiagnosticContext, overhaul Downloads console output #1565
base: main
Are you sure you want to change the base?
Conversation
…or information, and change all MessageSink interaction to be line-oriented. More than one line can be printed at a time, but there must be a line *between* messages.
…on rather than saying there was a download failure when no download was attempted.
…r is always added.
Fixes many longstanding bugs and hopefully makes our console output for this more understandable: * We no longer print 'error' when an asset cache misses but the authoritative download succeeds. * We now always and consistently print output from x-script s at the time that actually happens. Resolves https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2300063 * We don't tell the user that proxy settings might fix a hash mismatch problem. * We do the the user that proxy settings might fix a download from asset cache problem. * We now always tell the user the full command line we tried when invoking an x-script that fails. * We don't crash if an x-script doesn't create the file we expect, or creates a file with the wrong hash. * We now always print what we are doing *before* touching the network, so if we hang the user knows which server is being problematic. Note that this includes storing back to asset caches which we were previously entirely silent about except in case of failure. Other changes: * Removed debug output about asset cache configuration. The output was misleading / wrong depending on readwrite settings, and echoing to the user exactly what they said before we've interpreted it is not useful debug output. (Contrast with other VcpkgPaths debug output which tend to be paths we have likely changed from something a user said)
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.
Partial Review: I just reviewed the output based on the end to end tests. What happens in a sha mismatch scenario with x-block-origin enabled?
"Asset cache hit for .*; downloaded from: .*" | ||
"A suitable version of cmake was not found \(required v[0-9\.]+\)\.", | ||
"Trying to download cmake-[0-9.]+-[^.]+\.(zip|tar\.gz) using asset cache file://$assetCacheRegex/[0-9a-z]+", | ||
"Download successful! Asset cache hit, did not try authoritative source https://github\.com/Kitware/CMake/releases/download/[^ ]+" |
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.
"Download successful! Asset cache hit, did not try authoritative source https://github\.com/Kitware/CMake/releases/download/[^ ]+" | |
Asset cache hit! |
I think that "Asset cache hit!" implies successful download which implies not trying the authoritative source. The previous line says we are engaging with asset cache so I don't think we need to say we didn't try the authoritative source.
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.
The original intended URI needs to be in the output somehow. Where do you want it go instead?
#azurl (no), x-block-origin (no), asset-cache (n/a), download (sha-mismatch) | ||
#Expected: Download message with the "you might need to configure a proxy" message and with expected/actual sha | ||
Refresh-TestRoot | ||
$expected = @( | ||
"Downloading https://example\.com -> example3\.html", | ||
"[^\n]+example3\.html\.\d+\.part: error: download from https://example\.com had an unexpected hash", |
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.
Do we want the error:
?
"[^\n]+example3\.html\.\d+\.part: error: download from https://example\.com had an unexpected hash", | |
"[^\n]+example3\.html\.\d+\.part: warning: download from https://example\.com had an unexpected hash", |
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.
It's fatal and we can't continue after it happens, so I think it needs to be error?
Remove-Item "$downloadsRoot/example3.html" | ||
$expected = @( | ||
"Trying to download example3\.html using asset cache file://$assetCacheRegex/[0-9a-z]+", | ||
"Download successful! Asset cache hit, did not try authoritative source https://example\.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.
Same as previous comment. I will add that in the opposite , Asset cache miss', scenario we simply say "Asset cache miss; trying authoritative source".
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.
Are you saying you want to remove Download successful!
?
SplitUrl -> SplitUrlView
# Conflicts: # src/vcpkg/base/downloads.cpp
Todo (to undraft):
asset-caching.ps1
for examples.Extensive overhaul of our downloads handling and console output; @JavierMatosD and I have gone back and forth several times and yet kept introducing unintended bugs in other places, which led me to believe targeted fixes would no longer cut it.
Fixes many longstanding bugs and hopefully makes our console output for this more understandable:
Other changes:
VcpkgPaths
debug output which tend to be paths we have likely changed from something a user said)Other notes:
DiagnosticContext
so it will be easy to audit that the foreground/background thread behavior is correct after this.Special thanks to @JavierMatosD for his help in review of the first console output attempts and for blowing the dust off this area in the first place.