-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
Fix progress meter in parallel mode #6840
Conversation
Make sure the total amount of DL/UL bytes are counted before the transfer finalizes. Otherwise if a transfer finishes too quick, its total numbers are not added, and results in a DL%/UL% that goes above 100%.
Is it reproducible? I'm trying to figure out why progress_meter wouldn't be called before progress_finalize, or if it is then why it is not updating those variables. Lines 2279 to 2331 in 3266b35
I do see progress_meter needs a time difference of at least 500 ms if not the final round. Perhaps there should be a check for the initial round as well. |
try this diff --git a/src/tool_progress.c b/src/tool_progress.c
index 7db6df9..20edaeb 100644
--- a/src/tool_progress.c
+++ b/src/tool_progress.c
@@ -174,13 +174,7 @@ bool progress_meter(struct GlobalConfig *global,
now = tvnow();
diff = tvdiff(now, stamp);
- if(!header) {
- header = TRUE;
- fputs("DL% UL% Dled Uled Xfers Live Qd "
- "Total Current Left Speed\n",
- global->errors);
- }
- if(final || (diff > 500)) {
+ if(!header || final || (diff > 500)) {
char time_left[10];
char time_total[10];
char time_spent[10];
@@ -199,6 +193,13 @@ bool progress_meter(struct GlobalConfig *global,
unsigned int i;
stamp = now;
+ if(!header) {
+ header = TRUE;
+ fputs("DL% UL% Dled Uled Xfers Live Qd "
+ "Total Current Left Speed\n",
+ global->errors);
+ }
+
/* first add the amounts of the already completed transfers */
all_dlnow += all_dlalready;
all_ulnow += all_ulalready; |
Yes, I found it is easily reproduced when you make a lot of medium-sized transfers on a high-speed link. For example, I was downloading 200 files (5 MB each) from localhost.
If the files are too small (e.g., 1 MB each), the transfers will finish too quickly and DL% will remain
And if the files are too big (e.g., 100 MB each), the progress is likely to be correct.
YMMV, because it depends on the loopback interface speed, and in turn your CPU speed, etc.
Because when a transfer is finished, parallel_transfers() deletes the progress_meter() is called periodically, and it may not catch a transfer's total bytes if the value was unknown during the last call, and the transfer is finished and deleted (i.e., lost) during the next call. (That is why the progress meter is correct when the file size is big enough.) So, you have to make sure progress_finalize() saves the value before it goes away.
This does not fix the issue. |
@jay you okay with this? |
Thanks |
Make sure the total amount of DL/UL bytes are counted before the transfer finalizes. Otherwise if a transfer finishes too quick, its total numbers may not be added, and results in a DL%/UL% that goes above 100%.