arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation
http://libtorrent.org
Other
5.27k stars 997 forks source link

Big file fastresume data rejected #7385

Open pqqsxhy opened 1 year ago

pqqsxhy commented 1 year ago

Please provide the following information

libtorrent version (or branch): RC_2_0 platform/architecture: windows/ android arm compiler and compiler version:

please describe what symptom you see, what you would expect to see instead and how to reproduce it.

When the file download is complete, save_resume_data_alert is received, and I call write_resume_data_buf. When the service is restarted, these resume files are loaded. The quick recovery of small files succeeds, but the quick recovery of large files (maybe larger than 10G) fails. It takes time to detect the files, although the files finally enter the seed state. Finally, I set through specific logic; lt::add_torrent_params atp; atp.flags |= lt::torrent_flags::seed_mode;

Time-consuming detection is circumvented, but this method is not perfect, and I don't understand why it fails for large files.

2023/04/10 10:26:30.936904 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: creating torrent: app-l6swbjm1.vhdx max-uploads: 16777215 max-connections: 50 upload-limit: -1 download-limit: -1 flags: apply-ip-filter paused auto-managed update-subscribe save-path: C:\images\app-l6swbjm1\ver-fqw0gzmb\ 2023/04/10 10:26:30.936904 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: UPDATE LIST [ torrent_want_scrape : 1 ] 2023/04/10 10:26:30.936904 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: init torrent: app-l6swbjm1.vhdx 2023/04/10 10:26:30.936904 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: init, torrent flags:352440 2023/04/10 10:26:30.936904 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: init, async_check_files 2023/04/10 10:26:30.951529 log.go:220: [INFO] add torrent:app-l6swbjm1_ver-fqw0gzmb, handle:{id:2816471249 name:app-l6swbjm1.vhdx ses:0x29f7fd26f10} 2023/04/10 10:26:30.954746 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: fastresume data rejected: ret: 2 (0) op: unknown file: -1 The operation completed successfully 2023/04/10 10:26:30.959242 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: start_checking, m_checking_piece: 2 2023/04/10 10:26:30.959242 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: UPDATE LIST [ torrent_want_tick : 1 ] 2023/04/10 10:26:30.959242 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: *** UPDATE LIST [ torrent_want_scrape : 0 ] 2023/04/10 10:26:30.959242 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: on_piece_hashed, m_checking_piece: 3 2023/04/10 10:26:30.959242 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: on_piece_hashed, m_checking_piece: 4 2023/04/10 10:26:30.959242 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: on_piece_hashed, m_checking_piece: 5 2023/04/10 10:26:30.959242 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: on_piece_hashed, m_checking_piece: 6 2023/04/10 10:26:30.959242 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: on_piece_hashed, m_checking_piece: 7 2023/04/10 10:26:30.959242 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: on_piece_hashed, m_checking_piece: 8 2023/04/10 10:26:30.959242 log.go:220: [INFO] alert:80, log:LtTorrentLogAlert:app-l6swbjm1.vhdx: on_piece_hashed, m_checking_piece: 9

arvidn commented 1 year ago

when it fails, there's supposed to be a message in the log saying something like "fast resume rejected" with an error message, at least giving a hint of why it was rejected.

If you have a log with that message in it, that would be helpful in understanding what's going on

pqqsxhy commented 1 year ago

when it fails, there's supposed to be a message in the log saying something like "fast resume rejected" with an error message, at least giving a hint of why it was rejected.

If you have a log with that message in it, that would be helpful in understanding what's going on

There is only such a line of log, "fastresume data rejected: ret: 2 (0) op: unknown file: -1 The operation completed successfully"

arvidn commented 1 year ago

That message is a torrent debug log, do you also get a fastresume_rejected_alert? If you don't, you may need to enable alert_category::status in the alert mask. The other reason might be that the add_torrent_params object you passed in didn't have any resume data in it. It might be worth exploring if loading of the resume data is failing before you pass it to libtorrent.

How do you load the resume data from disk? Do you use read_resume_data() or do you use the deprecated mechanism of adding a buffer to add_torrent_params::resume_data?

Which disk I/O backend are you using, posix or mmap? (if you're on a 32 bit system it will be posix).

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.