Opened 21 months ago

Last modified 5 months ago

#2833 new bug

multiple torrents with overlapping folder structures lose incomplete files when 1st torrent completes

Reported by: eguled Owned by:
Priority: major Milestone: needs verified
Component: Unknown Version: 1.3.15
Keywords: overlaps incomplete moved folders temporary files completed Cc:

Description

I have seen this issue multiple times, with multiple torrent sets under Deluge v1.3.12 (libtorrent v1.0.6.0) running on Windows 7 x64. This issue can result in lost data which can be expensive if the files involved are large and the bandwidth is metered... :-(

Issue: Start 2 different torrents that each contain an overlapping folder structure. Let's call them "A" and "B".

While downloading, files for both A and B are stored in the same parent folder under the Deluge working/incomplete files directory.

When torrent A completes downloading, if the users has selected the option to "move completed to" [user-specific folder], then the entire parent directory -- and consequentially all the files for *both* torrents -- gets moved rather than moving only the completed files for torrent A. The result is that torrent A completes successfully and files are moved to correct location, but that torrent B loses any progress it had an shows an Error in the UI.

I'm not sure if this happens in Deluge itself or in libtorrent (I suspect it may be the latter). But it seems like the fix would be to be to, on completion, a) first check if the folder overlaps with another incomplete torrent, if not proceed as normal. if overlap is found, have the code enumerate the individual files of the completed torrent and move them 1x1 rather than simple moving the directory. this could potentially leave empty folders behind in the temp directory unless they are accounted for as well, but I think that is a much better consequence than lost data.

Simple, contrived example:

Torrent A contains: livediscs\lmde-2-201503-cinnamon-64bit.iso

Torrent B contains: livediscs\linuxmint-17.3-cinnamon-64bit.iso

WIP location: D:\temp

"Move Completed To" location: D:\Downloads

Current behavior:

Point in time Torrent State = Location
start A In-Progress D:\temp\livediscs\lmde-2-201503-cinnamon-64bit.iso
start B In-Progress D:\temp\livediscs\linuxmint-17.3-cinnamon-64bit.iso
A has finished A Complete D:\Downloads\livediscs\lmde-2-201503-cinnamon-64bit.iso
A has finished B In-Progress D:\Downloads\livediscs\linuxmint-17.3-cinnamon-64bit.iso

Expected behavior:

Point in time Torrent State = Location
start A In-Progress D:\temp\livediscs\lmde-2-201503-cinnamon-64bit.iso
start B In-Progress D:\temp\livediscs\linuxmint-17.3-cinnamon-64bit.iso
A has finished A Complete D:\Downloads\livediscs\lmde-2-201503-cinnamon-64bit.iso
A has finished B In-Progress D:\temp\livediscs\linuxmint-17.3-cinnamon-64bit.iso

Change History (3)

comment:1 Changed 21 months ago by eguled

I realized that there is a workaround for this, assuming that the torrents are not downloading faster than you can do it.

  1. Select torrent A
  2. Click on Files tab
  3. Double-click on top-level folder in the torrent and give it a custom name
  4. Repeat steps 1-3 with torrent B using a different name

Everything looked correct in my temp folder and after torrent A completed, only torrent A's files were moved.

It would still be nice to have this fixed so that it works without user intervention. But considering the workaround, this issue is probably a lower priority.

comment:2 Changed 5 months ago by Harkonnen

The bug is still there and a current (1.3.15) behavior is actually worse than the one described in a ticket. Deluge still moves an entire directory upon completion of the first torrent, but instead of error and losing incomplete files you end up with corrupted files from a second torrent in a target-to-move directory while deluge thinks that this files are ok and completed. Recheck usually shows 95-97% completion so it seems it looses chunks that were been downloaded at exact time of moving but does mark them as completed.

comment:3 Changed 5 months ago by Harkonnen

  • Version changed from 1.3.12 to 1.3.15
Note: See TracTickets for help on using tickets.