Closed veloman-yunkan closed 4 months ago
@veloman-yunkan This sounds a very serious problem, even if user reports mostly problems with big downloads. Eventually, this bug should probably be fix ASAP... Or do I miss something?
I will fix it together with the other download-related bugs in kiwix-desktop (on which I am working currently).
While you are working on this, you may want to investigate the JSON-RPC over WebSocket of aria2 (https://aria2.github.io/manual/en/html/aria2c.html#rpc-interface)
We would need a client library that support WebSocket, but it would allow aria to send notification back to us, and so we would have to pull information, just wait for notification.
Well, this ticket turned out to be a false alarm caused by a problem I was seeing in kiwix-desktop
. I was quick to blame it on kiwix::Downloader
after looking only at Downloader::getDownload()
and noticing that when called with a download-id missing from its cache it only checks active and waiting downloads:
Now I see that download-ids are added to the cache as soon as they are obtained from aria in Downloader::startDownload()
:
Since the download cache is never pruned the bug observed in kiwix-desktop
should have a different explanation, the most likely one (though also a purely hypothetical one, as now I can't reproduce the bug) being that completion of the download was properly detected but improperly handled - the download id registered with the book was reset but the download kept being queried with that empty invalid id.
kiwix::Downloader
only intercepts (and caches) downloads while they are in waiting or active state. As a result a small download that is completed before an access to it viakiwix::Downloader
is attempted will never be returned.