aclap-dev / vdhcoapp

Companion application for Video DownloadHelper browser add-on
GNU General Public License v2.0
1.72k stars 280 forks source link

Downloads to temporary folder & volume with less free space than the destination folder & volume. #75

Closed jpaugh closed 3 years ago

jpaugh commented 4 years ago

I'm using Firefox on Ubuntu 18.04. My dwhelper folder is on a separate volume than my /tmp folder, because I mount /home and / separately.

The filesystem I chose to download a video to (my /home volume) has plenty of free space; yet the download crashed with a disk-space error. The only other choice is /, which is considerably smaller.

At first, I supposed that the companion app saved a copy of the download as a temporary file in another filesystem; but the code looks like it chooses the correct file name.

I changed the extension's "Download Processor" setting to use the Browser. The Firefox UI (except for the extension) did not indicate that a new download was queued, which surprised me. Unfortunately, it still saved to the / volume, but this time it finished! Either it used less temp space this time, or I had slightly more free space available.

The file is clearly getting saved to the /tmp folder. While re-downloading, I see a file named /tmp/vdh-12943IgGlQ79g6fv7.tmp which grows along with the download, and it is of the right type:

$ file /tmp/vdh-12943IgGlQ79g6fv7.tmp
ISO Media, MPEG v4 system, Dynamic Adaptive Streaming over HTTP

I tried re-downloading with the original settings (using the Companion App), and two similarly named temporary files got saved to /tmp. I cancelled before it finished.

I think the issue is in the VDH extension, rather than the companion app, since it happens regardless of the choice of "Download Processor," and because of the "vdh-" prefix on the temp file. Also, I know that when the user downloads a file normally, Firefox downloads the temporary file to the same location as the final download, which avoids crossing filesystem boundaries.

mi-g commented 3 years ago

The choice of the temporary location is picked for all platforms from a very popular node package called tmp (https://github.com/raszi/node-tmp). I prefer to keep it the way it is rather to rewrite this module. I guess you should make such that you have enough space for your need in /tmp regardless of the volume it has been mounted from.

tari3x commented 3 years ago

As a developer, I understand your sentiment, but as a user, I'd like to give a strong +1 to this ticket. If I am performing an action which is "download into X" I expect it to only use disk space in X and it is rather frustrating to be proven wrong 1GB into the download.

My understanding of /tmp is that it is not intended for storing big amounts of data. On many systems where /tmp is a separate mount, it will often be really small, something like 2-4GB, in my experience.