-
Notifications
You must be signed in to change notification settings - Fork 905
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
Wrong download progress reported during package upgrade #872
Comments
Chocolatey's log files capture verbose/debug output, so you can provide the output. :) However I don't think we'll need it. The numbers being off - it only displays progress every so many bytes, that's why you see 96% and then it is done. We probably need a better capture at true 100% to show the totals properly. |
I instrumented PoshHostUserInterface.WriteProgress() to see what was going on here. I discovered two issues that affected both the initial install and package upgrades. First, in Get-WebFile.ps1, we have this at line 285:
Unlike line 281, this one doesn't pass a -PercentComplete. This resulted in a hit on the -1 condition in WriteProgress(), which short-circuits the method and immediately exits. With instrumentation it looked like this:
After I changed Get-WebFile.ps1 to pass -PercentComplete 100 on line 285, we started skipping WriteProgress due to hasLoggedFinalProgress being true. My instrumented version showed:
I completely removed the hasLoggedFinalProgress logic, and now the output looks like what I think was intended:
I'm not sure if that final progress logic was intended to defend against some other issue? Anyway, I'll go ahead and open a pull request and you can take a look. |
@bill-long so am I hearing there is more than issue of just reporting then? |
No, it's just an issue of what gets reported. There are two scenarios that cause it to skip reporting the last bits of the file, even though it does actually complete. This affects both the install of new packages and upgrades of existing packages. |
Always pass -PercentComplete to Write-Progress, otherwise the output will not be logged due to the -1 check. Because we can reach 100% when there are a few bytes left to retrieve, allow further logging of progress even if we reached 100%. In Get-WebFile and Get-FtpFile, don't log completion until we read 0 bytes from the stream. Also, when calculating the percentage, round down instead of up so we don't log 100% until we are actually at 100%.
Will be fixed in 0.9.10.4. Thanks @bill-long! |
What You Are Seeing?
Wrong download progress reported during package upgrade.
For example:
or
What is Expected?
Correct download size and progress being displayed.
How Did You Get This To Happen? (Steps to Reproduce)
I just called
choco upgrade sysinternals fiddler4 filezilla ccleaner deluge git.install -y
for the first rund andchoco upgrade libreoffice -y --debug --verbose
for the second run.Output Log
I can't provide a log with verbose or debug output enabled for the first run as the upgrade is already finished.
I then only upgraded libreoffice with --debug and --verbose in the second run.
Log for the first run:
Log for the second run:
The text was updated successfully, but these errors were encountered: