Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] libtorrent 2.0 freezes on Windows due Disk Write Queue length on preallocating files #7560

Open
ukoz opened this issue Nov 20, 2023 · 3 comments

Comments

@ukoz
Copy link

ukoz commented Nov 20, 2023

libtorrent 2.0, Win10 x64, local HDD.

libtorrent 2.0 allow program UI to keep updating on heavy file IO operations.
Adding torrents with big (over 20GB) files still freeze operations to torrent: .queue_position_up() or changing priority of files inside torrent. This can be very long wait. With 150MB/s HDD pre-allocating 50GB is over 5 minutes.

libtorrent 2.0 need option to enable_set_file_valid_data pre-allocate disk space (presumably in separate thread), prior to starting torrent, as extra lt::torrent_status::state_t. Have to skip state_t::checking_files.

Option to delete file on download_priority_t set 0 or priority selector (pause) before pre-allocate happen (without checking_files).

@ValeZAA
Copy link

ValeZAA commented Jan 16, 2024

150MB/s HDD pre-allocating 50GB is over 5 minutes.

You usually need to pre-allocate sparse files not zero'd files. Sprase files are just metadata.

@ukoz
Copy link
Author

ukoz commented Jan 21, 2024

Then freezes gonna be split to random periods (when data received) and computer impossible to use at random times instead (which is worse).

@arvidn
Copy link
Owner

arvidn commented Feb 17, 2024

libtorrent does support SetFileValidData, but it requires running as Administrator. So, in practice it's not necessarily practical.

File allocation happens in the disk thread, unless you're using posix_disk_io, which is not threaded. If you're using the mmap_disk_io and you still experience this, it's possible the page-cache/memory pressure is causing the issues you experience.

You can set file priorities in the add_torrent_params as you add the torrent. If you do that, and set a file's priority to 0, it won't be allocated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@arvidn @ukoz @ValeZAA and others