axel icon indicating copy to clipboard operation
axel copied to clipboard

progress output with `dialog` gets stuck

Open ismaell opened this issue 2 years ago • 7 comments

Just want to add, I had problems with dialog where it would get stuck sometimes and stop updating. I think maybe it was caused by too much / too fast / repeating output same numbers from axel.

I "solved" it by piping to awk first to clean it up and only output the numbers when they actually change...

axel -p https://downloads.freepbxdistro.org/ISO/SNG7-PBX16-64bit-2202-2.iso |
awk '/^[0-9]+$/ {if($0!=last) print; fflush(); last=$0 }' |
dialog --gauge "Downloading FreePBX" 6 40

Originally posted by @luckman212 in https://github.com/axel-download-accelerator/axel/issues/348#issuecomment-1046101466

ismaell avatar Feb 19 '22 22:02 ismaell

It's not so much the repeats themselves, but that dialog is too slow updating the screen. Throttling the output might make sense.

ismaell avatar Feb 24 '22 18:02 ismaell

Hi @ismaell I am participating in hacktoberfest 2022. Can I work on this issue as a part of it. If yes, can you please explain a bit more on whats needs to be done. Thank you,

anindyasen avatar Sep 29 '22 08:09 anindyasen

The simplest/general solution is to throttle the output, so:

  1. find where progress reporting function is called
  2. track the time at which it is called
  3. skip call if it has been called recently (let's say, in the last 200ms, which is a quite fast pace for humans)

ismaell avatar Sep 29 '22 15:09 ismaell

Hi @ismaell After running the latest main branch what I am observing is: Running:

axel  https://downloads.freepbxdistro.org/ISO/SNG7-PBX16-64bit-2202-2.iso

Giving output:

axel  https://downloads.freepbxdistro.org/ISO/SNG7-PBX16-64bit-2202-2.iso
Initializing download: https://downloads.freepbxdistro.org/ISO/SNG7-PBX16-64bit-2202-2.iso
File size: 2.29688 Gigabyte(s) (2466250752 bytes)
Opening output file SNG7-PBX16-64bit-2202-2.iso.0
Starting download

[  0%] [0                     1                     2                     3                     ] [   1.2MB/s] [31:56]
[ 10%] [..0                   ..1                   ..2                   ..3                   ] [   3.9MB/s] [09:04]
[ 12%] [..0                   ..1                   ..2                   ..3                   ] [   3.9MB/s] [08:55]Connection 2 finished
Connection 0 finished
Connection 1 finished
Connection 3 finished
Connection 3 finished
Connection 0 finished
Connection 2 finished

Downloaded 2.29688 Gigabyte(s) in 9:38 minute(s). (4160.01 KB/s)

But I am not seeing the dialog getting stuck. When file was getting downloaded, I didn't observe it struck.

When I used the command with -p option Then terminal is flooding with the below output

Opening output file SNG7-PBX16-64bit-2202-2.iso
Starting download

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Error on connection 1! Connection closed
[  0%] [0                     1                     2                     3                     ] [   1.7MB/s] [23:32]
Downloaded 8.4601 Megabyte(s) in 5 second(s). (1697.76 KB/s)

I pressed ctrl+c to stop it. This one looks like a bug. Is this what it means by progress output stuck? Thanks.

anindyasen avatar Sep 30 '22 13:09 anindyasen

@anindyasen it refers to the dialog program (in other words, calling: axel -p ...|dialog --gauge ...; axel produces too much output for it, often repeating the number, which is unnecessary (both the frequency of the output and repeating of the same number would, even if processed in time, lead to something the user can't see).

ismaell avatar Oct 03 '22 15:10 ismaell

Hi @ismaell Thanks for the explanation. So, I am thinking to to print the percentage output only when it changes, ie. every percentage value from 1 to 100 will print only once. Will that implementation work?

Thanks

anindyasen avatar Oct 03 '22 19:10 anindyasen

Please refer to the previous comment: https://github.com/axel-download-accelerator/axel/issues/374#issuecomment-1262459577

It has to be time-driven instead.

ismaell avatar Oct 13 '22 18:10 ismaell