Torrent shows as complete but some files are missing from disk
Problem Description
A torrent shows as 100% complete and enters seeding state, but some files are physically missing from disk. Re-checking file integrity and removing fast resume data does not help resolve the issue. This creates an inconsistent state where the torrent appears complete but cannot provide data for missing files. This happens on certain torrent files with 100% frequency. Changing the size of the chunk fixes this problem, but I don't consider it a valid solution. The situation occurs when the torrent is updated and rolls over existing files, and fully downloading the torrent fixes the problem.
The problem is stable and reproducible on different PC.
Current Behavior During file checking phase (CheckingFiles state), when a file is missing, the code in torrent.cpp:on_piece_hashed() correctly detects the error:
if (error.ec == boost::system::errc::no_such_file_or_directory
|| error.ec == boost::asio::error::eof
|| error.ec == lt::errors::file_too_short
// ...
)
{
// skip this file by updating m_checking_piece to the first piece following it
// ...
}
However, later in the same function, piece_flushed() is called even for pieces containing missing files:
if (hash_passed[0] || hash_passed[1])
{
if (has_picker() || !m_have_all)
{
need_picker();
m_picker->piece_flushed(piece); // ← Called even for pieces with missing files
// ...
}
}
The current quick fix that fixed my problem specifically. Will it lead to any problems and is there an understanding of where the real root of the problem may be?
else if (!error // <- possible fix
&& (hash_passed[0] || hash_passed[1]))
{
if (has_picker() || !m_have_all)
{
need_picker();
m_picker->piece_flushed(piece);
set_need_save_resume(torrent_handle::if_download_progress);
update_gauge();
}
we_have(piece);
}
Libtorrent from branch RC_2.0 Platform windows 10