qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
27.73k stars 3.92k forks source link

Completed torrents randomly marked as "Missing Files" #19540

Open Leinaria opened 1 year ago

Leinaria commented 1 year ago

qBittorrent & operating system versions

qBittorent: 4.5.5 x64 and 4.5.4 x64 (and possibly previous) OS: Windows 10 Pro 22H2 (10.0.19045) x64

What is the problem?

Some Completed torrents are being marked as Missing Files.

Currently I have 13 torrents marked as Missing Files to 499 Completed torrents, so 2.5% of Completed torrents are being marked as Missing Files.

Some torrents were completed 6 months ago, some were only completed 2 week ago. The smallest is 247MB, the largest is 2.75GB. Each torrent is only a single file (if a torrent contains more than one file, only one file is selected to be downloaded). All are still present on the drive.

If I select Force Recheck, one of three things will happen:

Checking the log files, I find this: (W) 2023-08-31T10:48:42 - Failed to restore torrent. Files were probably moved or storage isn't accessible. Torrent: "TORENT_NAME". Reason: "TORENT_NAME fast resume rejected. check_resume(TORRENT_FILE_PATH): mismatching file size" The file is there, and I don't know why it would suddenly throw a mismatching file size error.

Steps to reproduce

  1. Download torrent
  2. Wait days or weeks or months and get unlucky
  3. Random previously Completed torrent suddenly gets marked Missing Files

Additional context

Missing Files

Log(s) & preferences file(s)

qBittorrent.zip qBittorrent-data.zip qbittorrent.log qbittorrent.log.zip The log in the Zip is older and has several of these errors. Some are legitimately for files that I deleted, but many are for files that are still there.

DarkVoyage commented 1 year ago

Sometimes previously completed torrents end up missing pieces after months or years. Sometimes qBt completes torrent and it fails. After recheck you see missed pieces. I think this is some kind of I/O overload. System reports something as correctly written, but data didn't actually get to HDD. But you have much worse stats than at the acceptable level of error - about 2-3 randomly damaged files in 50TB of data for years. HDD has a statistical error level, any system has.

ZoltrixGFC commented 1 year ago

Can confirm the same issue. Using version 4.5.5 on Windows 10 22H2 x64.

Being using qBittorrent on the same OS for a good while, only thing that changed is I recently updated to 4.5.5

Today a portion of torrents (17 out of 455) are showing the "Missing Files" status. Storage and file paths have not changed. If I right click on the torrent and select "Open destination folder", it opens fine, and the files are visable. Have attempted to do a force recheck, it hangs and doesn't progress.

Other torrents using the same location are reporting as fine and not missing any files.

Have restarted the whole OS and qBittorrent, same result. Logs files just display, "Failed to restore torrent. Files were probably moved or storage isn't accessible". Which is not accurate, as said above, I can open the folders directly from qBittorrent.

Leinaria commented 1 year ago

Maybe you have multiple torrents that have same file names and locations?

Then some torrents will overwrite file data and recheck will show some pieces are missing?

Nope, these torrents all have unique file names and folder locations, so nothing is overwriting anything else (unless I Force Recheck the affected torrents, in which case qBt has a roughly 10% chance of marking the whole file as missing and overwrites a completed file with an empty one).

All the affected files are .mp4 files, if that makes any difference.

StableBit Scanner is reporting that all the storage drives are healthy without any issues.

ZoltrixGFC commented 11 months ago

Happened again on 4.6.0, but this time the force recheck actually worked.

axet commented 8 months ago

v4.5.2

I have similar issue. qbittorrent can't find files with error described above. Torrent was originally created by qbittorrent, I can recreate torrent, add it to the list, then restart qbittorrent - and torrent become "missing"

13.02.2024 07:03 - Failed to restore torrent. Files were probably moved or storage isn't accessible. Torrent: "TheException". Reason: "TheException fast resume rejected. file_stat(/media/axet/1TB/Games/TheException/TheException/readme.1.txt): mismatching file size"

'readme.1.txt' never existed, real name is "readme.txt".

ZoltrixGFC commented 8 months ago

Missing files issue still happening (now on version (v4.6.3). Issue occurs randomly after a restart of PC... force recheck does find them again.

glassez commented 8 months ago

Missing files issue still happening (now on version (v4.6.3). Issue occurs randomly after a restart of PC...

I have never encountered this problem. What am I doing wrong?

But seriously, comments like yours above, without any details, circumstances and logs, do not bring any benefit to solving the problem.

ZoltrixGFC commented 8 months ago

@glassez comments like yours without reading the whole thread isn't helpful either. I posted a detailed reply on 13th Sep regarding the issue. My follow-up is to report the same issue still exists on a newer version. Why copy paste what I already said.

glassez commented 8 months ago

@glassez comments like yours without reading the whole thread isn't helpful either.

Unfortunately, your comment is no different from all the many similar "me too" comments that have nothing more behind them. In any case, it's a good idea in such time-consuming discussions to explicitly refer to the previous comment if you intend to continue/supplement it. There is no desire to re-read all these threads every time.

I posted a detailed reply on 13th Sep regarding the issue.

Even your previous "detailed" reply has no corresponding log messages provided and just mentioned them in reduced from which is not so helpful in order to figure out something.

axet commented 8 months ago

Guys. Not productive.

All answers in my comment. qbittorrent messing with file names. App checking 'readme.1.txt' file which never exists on disk nor torrent file it self. Easy to lookup, right?

ZoltrixGFC commented 8 months ago

@axet your comment is the least productive as you've hijacked a thread that has nothing to do with files being renamed 🤣

This thread was about the client reporting files as missing, that actually still exist and have the correct filenames.

axet commented 8 months ago

@ZoltrixGFC glassez 🤝 were right by telling you to show logs.

glassez commented 8 months ago

All answers in my comment. qbittorrent messing with file names. App checking 'readme.1.txt' file which never exists on disk nor torrent file it self. Easy to lookup, right?

Unfortunately, no. Your comment does not allow someone outside to accurately imagine the described process.

Torrent was originally created by qbittorrent, I can recreate torrent, add it to the list, then restart qbittorrent - and torrent become "missing"

It looks confusing for me.

axet commented 8 months ago

Ok here is a torrent file:

It has been created by qbittorrent 4.5.2.

files are missing with (torrent file list keep saying 'readme.txt'):

13.02.2024 09:48 - Failed to restore torrent. Files were probably moved or storage isn't accessible. Torrent: "TheException". Reason: "TheException fast resume rejected. file_stat(/media/axet/1TB/Games/TheException/TheException/readme.1.txt): mismatching file size"

restart it again:

13.02.2024 09:50 - Failed to restore torrent. Files were probably moved or storage isn't accessible. Torrent: "TheException". Reason: "TheException fast resume rejected. file_stat(/media/axet/1TB/Games/TheException/TheException/readme.1.txt): mismatching file size"

now torrent files list showing 'readme.1.txt'

axet commented 8 months ago

Ok. I got it. libtorrent-rasterbar does not handle case sensitive torrents. With duplicate file names. That is one issue.

glassez commented 8 months ago

Ok. I got it. libtorrent-rasterbar does not handle case sensitive torrents. With duplicate file names. That is one issue.

If we talks about Windows then libtorrent most likely uses case-insensitive file names handling on this platform.

axet commented 8 months ago

I'm using Linux.

glassez commented 8 months ago

I'm using Linux.

I just managed to add this torrent to qBittorrent on Linux without any problems and it created both readme.txt and ReadMe.txt files for me. If I had the torrent content, I could test your scenario.

BTW, we reject discussing issues unless they are confirmed in the current version. v4.5.2 is outdated.

glassez commented 8 months ago

@axet ...and yes, your problem is most likely offtopic in this Issue.

Leinaria commented 5 months ago

Just tried this again on qBittorrent v4.6.4 on Windows with two MP4 torrents that had previously been marked Completed last year but were later marked as Missing Files. Both videos played just fine.

The first torrent recheck found 99% of the file, missing only one 7MB piece. It downloaded the supposedly missing piece and marked it Completed again.

The second torrent recheck found 1% of the file, saying that I only had two 512KB pieces and was missing the other 1191 pieces. However, this video played just fine before and still plays just fine now. qBittorrent says that I'm missing 99.9% of it, yet I can play it in VLC all the way through. I guess the good news is that it didn't delete the file.

Error in the log says for each Errored torrent: Failed to restore torrent. Files were probably moved or storage isn't accessible. Torrent: "NAME". Reason: "NAME fast resume rejected. check_resume(LOCATION): mismatching file size"

I checked all the files: they're there, they play all the way through, I couldn't find any issue with them.

ZoltrixGFC commented 5 months ago

I found out it was only happening when the VM I was hosting qBittorrent on was restarted. Perhaps a race condition of some type. I setup an task in Task Schedular to delay the start of qBittorrent by 5 mins on VM restart, and haven't seen the missing files issue since.

Leinaria commented 5 months ago

I just tried Force Check on 8 more video files that had Errored: 2 found 99.8% (one was missing one 2MB piece, the other a 128KB piece), 1 found 96.6% (missing 70 128KB pieces), while the other 5 found 0% (of video files that play just fine).

I found out it was only happening when the VM I was hosting qBittorrent on was restarted. Perhaps a race condition of some type. I setup an task in Task Schedular to delay the start of qBittorrent by 5 mins on VM restart, and haven't seen the missing files issue since.

I'm not using a VM, and qBittorrent isn't set to start up automatically with Windows, so I don't think that's my issue.

glassez commented 5 months ago

other 5 found 0% (of video files that play just fine).

You could copy such files to another location, then re-download them using qBittorrent and compare them with the copied ones.

Leinaria commented 5 months ago

I can confirm that this is still an issue in qBittorrent v4.6.4

I had an mp4 video file that I completed on 5/9/2024 that's now shown as Missing Files. Log error is: Failed to restore torrent. Files were probably moved or storage isn't accessible. Torrent NAME Reason: "NAME fast resume rejected. check_resume(FILE): mismatching file size"

Forcing a recheck found 99.6%, missing 1.7MB across two 1MB pieces.

You could copy such files to another location, then re-download them using qBittorrent and compare them with the copied ones.

I just did that with the video file that was reported as missing above. The previously downloaded file has a Size of 555,502,208 bytes While the newly downloaded file has a Size of 555,502,256 bytes Both have the same Size on disk of 555,503,616 bytes

So somehow 48 bytes went missing in the old file? It would explain why their would be a size mismatch, though not why it would show 1.7 MB missing unless those 48 bytes were somehow spread across two 1MB pieces. No idea why or how 48 bytes would go missing from an mp4 file.

glassez commented 4 months ago

So somehow 48 bytes went missing in the old file? It would explain why their would be a size mismatch, though not why it would show 1.7 MB missing unless those 48 bytes were somehow spread across two 1MB pieces. No idea why or how 48 bytes would go missing from an mp4 file.

A difference of 48 bytes does not mean at all that you have 48 bytes lost. For example, you can have a larger piece of data (N bytes) replaced with another (N-48 bytes). It would be nice to compare the difference in data (not just in size) of these two file variants. Perhaps some third-party program has made changes there (for example, to some metadata).

Leinaria commented 4 months ago

So somehow 48 bytes went missing in the old file? It would explain why their would be a size mismatch, though not why it would show 1.7 MB missing unless those 48 bytes were somehow spread across two 1MB pieces. No idea why or how 48 bytes would go missing from an mp4 file.

A difference of 48 bytes does not mean at all that you have 48 bytes lost. For example, you can have a larger piece of data (N bytes) replaced with another (N-48 bytes). It would be nice to compare the difference in data (not just in size) of these two file variants. Perhaps some third-party program has made changes there (for example, to some metadata).

I think you figured it out when you suggested metadata. I just compared a few more files:

A old is 1,147,129,341 bytes A new is 1,147,129,457 bytes A difference is 116 bytes, metadata was changed on the old one

B old is 1,261,924,018 bytes B new is 1,261,924,104 bytes B difference is 86 bytes, metadata was changed on the old one

C old is 2,336,500,563 bytes C new is 2,336,500,653 bytes C difference is 90 bytes, metadata was changed on the old one

I tried changing the metadata on the files to match the old files - clearing the title and comments fields - and the new file sizes then matched the old file sizes exactly. So the metadata was changed which caused the files to have different file sizes which caused qBittorrent to mark them as missing?

Leinaria commented 4 months ago

So somehow 48 bytes went missing in the old file? It would explain why their would be a size mismatch, though not why it would show 1.7 MB missing unless those 48 bytes were somehow spread across two 1MB pieces. No idea why or how 48 bytes would go missing from an mp4 file.

A difference of 48 bytes does not mean at all that you have 48 bytes lost. For example, you can have a larger piece of data (N bytes) replaced with another (N-48 bytes). It would be nice to compare the difference in data (not just in size) of these two file variants. Perhaps some third-party program has made changes there (for example, to some metadata).

I think you figured it out when you suggested metadata. I just compared a few more files:

A old is 1,147,129,341 bytes A new is 1,147,129,457 bytes A difference is 116 bytes, metadata was changed on the old one

B old is 1,261,924,018 bytes B new is 1,261,924,104 bytes B difference is 86 bytes, metadata was changed on the old one

C old is 2,336,500,563 bytes C new is 2,336,500,653 bytes C difference is 90 bytes, metadata was changed on the old one

I tried changing the metadata on the files to match the old files - clearing the title and comments fields - and the new file sizes then matched the old file sizes exactly. So the metadata was changed which caused the files to have different file sizes which caused qBittorrent to mark them as missing?

Well, I updated qBittorrent to 4.6.5, necessitating a restart, after changing the metadata for the three files and all three were marked as Missing Files. When I forced a recheck, qBittorrent said that it found 0% of the data for all three and started the download all over again from scratch for all of them. So it seems a change in metadata can cause qBittorrent to view the file as being different, and sometimes qBittorrent finds 99% of the file and just downloads the 1-2 missing chunks and other times it finds 0% of the file and has to start all over.

aussiebro commented 2 months ago

Did any one find a fix I keep losing a few torrents and having to re download them and it messes my private torrent ratio now. I'm thinking of trying another client. I tried different qbitorrent versions and it still occurs.

ZoltrixGFC commented 2 months ago

Is it only on a restart of the machine where you run qBittorrent?