node-downloader-helper icon indicating copy to clipboard operation
node-downloader-helper copied to clipboard

Downloaded size exceed 100%

Open khkassem opened this issue 3 years ago • 8 comments

Hello

Somtimes, without knowing the reason, i have the file continue downloading after 100% ! From my download logs : [2022-04-29 02:42:42.554] [silly] 528.0 kB/s - 1596.5% [4.7 GB/304.1 MB]

How it can happens?

Thank you

khkassem avatar Apr 29 '22 09:04 khkassem

Hello @khkassem, is this happening with different URL or only with this specific file? what could be happening is that the server is reporting wrongly the file size, ndh uses content-length header to determine the file size, if these URL are public, could you share it so i can try to reproduce myself? thanks

hgouveia avatar Apr 29 '22 09:04 hgouveia

Hello

I have 70 users downloading the same files, and i get this problem on 50% of them, when I download the file using chrome its ok, some times just restarting my software will continue the download correctly

The url is not public for now, i'll see if i can generate a public link with the same conditions.

Best reegards

khkassem avatar Apr 29 '22 09:04 khkassem

Hello

I have 70 users downloading the same files, and i get this problem on 50% of them, when I download the file using chrome its ok, some times just restarting my software will continue the download correctly

The url is not public for now, i'll see if i can generate a public link with the same conditions.

Best reegards

cool, also would be very helpful to know which version are you using, what options are you using, and repro steps, so i can try to reproduced it on my end

hgouveia avatar Apr 29 '22 11:04 hgouveia

Hello

It seems that I have this problem when I have multiple downloads at the same time I'll add this code to the progress management :

    newDownloadHelper.on('progress', async (state: Stats) => {
      const currentTime = new Date()
      const elaspsedTime = currentTime.getTime() - startTime.getTime()
      if (elaspsedTime > 3000) {
        const speed = byteHelper(state.speed)
        const progress = state.progress.toFixed(1)
        const downloaded = byteHelper(state.downloaded)
        const total = byteHelper(state.total)
        startTime = currentTime
        logger.silly(`${speed}/s - ${progress}% [${downloaded}/${total}]`)
        //id downloaded > total break the download
        if (downloaded > total) {
          logger.error(
            `download-manager progress downloaded greater than toatl, break download ${fileServerInfo.id} ${fileServerInfo.url}`
          )
          newDownloadHelper.stop()
        }
        await Download?.updateDownload({ progress: progress, status: 2 }, fileServerInfo.id)
        if (progressCallback) progressCallback(fileServerInfo.id, state)
      }
    })

Just to stop the download when the downloaded file size is more than the file size itself.

I am using node 12 and i am not able to ugrade now. I am using node downloader helper 2.1.0, I'll try to upgrade to the latest

Thank you

khkassem avatar May 01 '22 07:05 khkassem

@khkassem i released a new version v2.1.2 , could you try with this, and see if still happening?, also please make sure to create a new DownloadHelper per file

hgouveia avatar Aug 04 '22 16:08 hgouveia

I also have this problem, it seems to happen on insufficient disk space, and if the user remove some files in the middle of download.

roddc avatar Aug 14 '22 08:08 roddc

exceed 100% +1

SplitGemini avatar Sep 02 '22 17:09 SplitGemini

It happened when remote file is not resumable but a resume method call is performed. Such as restarting the file server

SplitGemini avatar Sep 02 '22 18:09 SplitGemini

It happened when remote file is not resumable but a resume method call is performed. Such as restarting the file server

Once resume, the problem will recur, even if remote file is resumable.

SplitGemini avatar Dec 20 '22 06:12 SplitGemini

One situation when error occured, it retries repeatedly. image

SplitGemini avatar Dec 20 '22 08:12 SplitGemini

fixed on #93

hgouveia avatar Feb 14 '23 06:02 hgouveia