This forum has been archived. All content is frozen. Please use KDE Discuss instead.

KTorrent failed to download file intact

Tags: None
(comma "," separated)
imported4-Anonymous
Registered Member
Posts
329
Karma
0
I just tried downloading a ~180MB video with KTorrent 1.1rc1 but when I got to the end I couldn't open the video.

I realised the video was corrupt, so I opened the torrent with bittornado and it found the file was only 92.8% complete.

Is it possible that KTorrent's SHA1 piece checksumming is not working properly? KTorrent told me the file was complete but 7.2% of the file did not checksum correctly (possibly poisoned by fake clients?).
imported4-Ivan
Registered Member
Posts
819
Karma
0

Sat Oct 08, 2005 2:05 am
It's strange that you couldn't even open that video. You only need a few first chunks of the file to start the video. If the video file is corrupt in somewhere in the middle or it has missing chunks that part is skipped in most video players. Is the first chunk downloaded? Does the KT show "Preview" - "yes" in FileView? Try previewing that file from KT.

Anyway, you should send that torrent to us so we can check it out. See FAQ on main page for email.

Another thing, try installing latest development version and use the tools from 'debugtools' directory. You'll find 'ktcachecheck' program and you can use it to scan your torX directory. It'll show you if any chunk has wrong checksum.
George
Moderator
Posts
5421
Karma
1

Sat Oct 08, 2005 10:27 am
Forget the lastest development version you can find the a 1.1 tarball here :

http://ktorrent.pwsp.net/downloads/1.1/

After you install it, cd to the folder to store temporary files (see settings dialog of ktorrent).

And in that directory :
ktcachcheck torX

Replacing X by the right number
George
Moderator
Posts
5421
Karma
1
Dan Pope wrote:I just tried downloading a ~180MB video with KTorrent
Is it possible that KTorrent's SHA1 piece checksumming is not working properly? KTorrent told me the file was complete but 7.2% of the file did not checksum correctly (possibly poisoned by fake clients?).


No checksumming works, poisoned chunks will be detected (unless they find a way to generate random data, which has the same checksum as the chunk).

The bug has to happen when we write the chunk to disk.
imported4-Anonymous
Registered Member
Posts
329
Karma
0

Sun Oct 09, 2005 12:37 pm
There's nothing in the cache. The torrent completed.

I still have a copy of the video as KTorrent saved it, and the complete and working file I finished with btdownloadcurses.
imported4-Anonymous
Registered Member
Posts
329
Karma
0

Sun Oct 09, 2005 3:59 pm
Ok, after a bit of Python scripting

Code: Select all
Bytes different:     13033070
Bytes compared: 183687088
Difference: 7.10%
Files are same length
Differences form 69551 contiguous chunks
Mean position of different bytes: 33.17%
Median position of different bytes: 30.21%


I filtered out bytes that differ, and they are not remotely random. I managed to compress the 13MB of differences down to 160KB with bzip2.

file identifies the poison as MPEG ADTS, layer I, v1, Monaural, which is what it identifies the corrupt download as. The valid download is correctly identified as an AVI stream.

No checksumming works, poisoned chunks will be detected (unless they find a way to generate random data, which has the same checksum as the chunk).


I assure you that it is impossible to forge a 160-bit SHA1 cryptographic hash :)

Besides, btdownloadcurses successfully identified the broken sections and replaced them.

The bug has to happen when we write the chunk to disk.


The data that I've extracted suggest that what has been wrongly written is low entropy (just looking at it, it's very repetitive), concentrated towards the start of the file, and is totally wrong rather than just the occasional byte error. I can't imagine why a bug in writing the data would produce these statistics but I don't know the code.
George
Moderator
Posts
5421
Karma
1

Sun Oct 09, 2005 4:25 pm
Send me the torrent, you can find my e-mail address in the faq

http://ktorrent.pwsp.net/index.php?page=faq#q2
noop
Registered Member
Posts
3
Karma
0
Hi from 2010. I have the same problem.
I've downloaded a video. Ktorrent says that torrent is ok and re-checks it successfully twice. Then video stucks on third minute. I re-check the torrent and around 50% of downloaded chunks are SUDDENLY appear to be broken.
Then ktorrent re-downloads broken chunks. After re-checking it has about 5% of broken chunks. Another re-download, torrent completed.
Fact that I have to make client re-download torrent from two up to ten times disappoint me.
Used version: 3.2.4, but the problem appears in newer and older versions. Any ideas?
Upd.
Now the video stalled on the 14th minute. After re-checking ktorrent found 85 corrupted chunks. Torrent attached: [attachment=0]346a14ffc44172ed919f0c0f7c2b1ccf718db827.torrent[/attachment]. Note that other clients do not have this problem, but ktorrent does not load CPU up to 100%.
George
Moderator
Posts
5421
Karma
1
Sounds to me like something else is corrupting that video, if a data check succeeds after the download, then it is fully downloaded.

What video player are you using ? Do you still seed the torrent once it is finished downloading ?
noop
Registered Member
Posts
3
Karma
0
>Sounds to me like something else is corrupting that video
Probably. But no other programs except KTorrent and video player are reading/writing to the file.
>if a data check succeeds after the download, then it is fully downloaded.
It would be just perfect. As I said before, KTorrent says that the video is downloaded and does data check after it. Data check is successful. To make sure, I re-check it twice and there are no corrupted chunks.
>What video player are you using ?
MPlayer and VLC. Mplayer exits with "Exiting... (End of file)" message, VLC shows glitches (like http://www.donrelyea.com/readymade_glit ... C03648.jpg), and video is freezes for few seconds. Then I start re-checking video and KTorrent finds up to 50% undownloaded/corrupted chunks.
>Do you still seed the torrent once it is finished downloading ?
Yes, I do. I've set "check chunks while uploading", but that has no effort.
George
Moderator
Posts
5421
Karma
1
What if you stop the torrent once it is finished, exit ktorrent and then start playing the video ?
noop
Registered Member
Posts
3
Karma
0
Nice idea. Will report after doing it.
<...>
It works. MD5 sum matches, video plays smoothly. Thanks.
But how about seeding while watching?


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]