Bug when disconnect user (disable segmented download)

Bug #237396 reported by Krzysztof
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DC++
Fix Released
High
Unassigned

Bug Description

Trouble when segmented download is disable and I disconnect user. An another user connect and I download in small pieces. Error "Incompatibility TTH" appears after some time.
DC++ 0.706

Revision history for this message
eMTee (realprogger) wrote :

I can confirm this, once after a disconnect and another user connected it started to download in smaller and smaller pieces - the smallest one was 8B (!) -, after the 8B piece it started to download a chunk size equals to the rest of the file. Then when it reaches 1MiB downloaded it gives TTH Inconsistency again and again.

Changed in dcplusplus:
status: New → Confirmed
Revision history for this message
poy (poy) wrote :

what i could reproduce were crashes, which should be now fixed; i didn't go as far as checking for possible TTH inconsistencies, so this needs to be tested a bit more...

Changed in dcplusplus:
importance: Undecided → High
status: Confirmed → Fix Committed
Revision history for this message
Big Muscle (bigmuscle) wrote :

I just looked at the fix quickly and I see some problem there. When segmented downloads are disabled, it always starts download from zero. I think it's not good. And also think about situation when seg.downloads are enabled at first and disabled later. Then there can be single nondownloaded segments.

Revision history for this message
poy (poy) wrote :

it's what i thought too, but i've tried to stop and re-start non-segmented downloads and they do resume roughly where they were left, not from the beginning.

the scenario where segmentation is enabled and then disabled while downloads are running is what was causing the crash. when you turn off segmented DLs, segments are not stopped, they can still be finished; however, new segments don't start if there are still other segments running for the current download. then once all segments are finished, one new big segment starts to download the rest of the file all by itself.

Revision history for this message
poy (poy) wrote :

you were right actually, Big Muscle, such a file couldn't end properly and it kept downloading the same segment over and over again. i hope the new fix is better...

Revision history for this message
Big Muscle (bigmuscle) wrote :

I think new fix would be ok if file is download as non-segmented from its beginning. There can be problem if segmented downloads are disabled during that download and it is disconnected.

Let's say (file is 30 MB)
Segment A = 10 MB (downloaded completely)
Segment B = 10 MB (downloaded first 5 MB)
Segment C = 10 MB (downloaded first 5 MB)

Now what happens when disabling segmented downloads and disconnect it? downloaded bytes will be 20 MB (10+5+5), so it will download from position 20 MB (begin of segment C). The first 5 MB of segment C will be redownloaded again and the last 5 MB of segment B will be missing. There will always be 25 MB downloaded bytes, so it redownload again and again last 5 MB of file and not segment B.

Revision history for this message
eMTee (realprogger) wrote :

Tested the last fix (bzr1249). The change for non-segmented download works, it finishes the download even with several disconnects and the file integrity is ok.
However, I also tested the scenario described by BM and it concluded almost the same as he predicted except that it crashes instead of start redownloading...
The resulted file has zero byte filled spaces in it in the positions where the segments disconnected. The disconnected segments are remained in the queue entry in queue.xml.

Revision history for this message
Big Muscle (bigmuscle) wrote :

I would suggest leave it as it was before any change and just ensure that targetsize (=remaining bytes) are TTH block size aligned (Maybe to uppoer bound). But it must be tested whether I'm right.

Revision history for this message
poy (poy) wrote :

now committed Big Muscle's suggestion; the few tests i did seemed fine. :)

Revision history for this message
eMTee (realprogger) wrote :

The last solution works well, for non-segmented downloads and also for when segmented downloads are disabled and segments disconnected during a download :)

MikeJJ (mrmikejj)
Changed in dcplusplus:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.