-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
RC_1_2: Crashes when checking torrent(s) with piece size of 256.0 MiB #7735
Comments
thanks for this detailed report! |
I have investigated this issue recently, so I can provide more technical details later. |
The following fields are too small. When you check the torrent with piece size >= 256 MiB some of them can overflow which leads to memory leak (or crash due to failed assertion when using development build). libtorrent/include/libtorrent/block_cache.hpp Lines 248 to 251 in 0ca20a3
Increasing their size to 15 bits is enough for libtorrent to successfully create and run torrents with a piece size of 256 MiB. |
The size of 16 bit will allow you to successfully create torrents of 512MB piece size. The following field size needs to be increased too: libtorrent/include/libtorrent/block_cache.hpp Lines 330 to 331 in 0ca20a3
|
Further increasing their size allowed me to successfully create a torrent of 1024 MiB piece size. libtorrent/include/libtorrent/block_cache.hpp Lines 230 to 236 in 0ca20a3
libtorrent/src/block_cache.cpp Line 620 in 0ca20a3
|
Note that despite the fact that I was able to successfully create torrents with a piece size up to 1024 MiB, libtorrent-1.2 still cannot run torrents with a piece size of more than 256 MiB due to limitations in other parts of the code. Perhaps they can be eliminated as easily as the ones above, but I have not progressed that far in this investigation. I'm not sure about the possibility to fix these drawbacks in the current versions of libtorrent. Won't this affect the ABIcompatibility @arvidn cares about? In addition, @arvidn seems to be concerned about maximum packing of data types, which is why all these bitfields are here. So I'm not sure how this could be changed in an acceptable way. |
This is the assert that fails:
|
At the very least, libtorrent should check torrent files earlier and reject them if they exceed these limits. |
👍 |
I thought the RC_2_0 branch actually supported 256 MiB pieces (but not larger). As far as I can tell, the check when loading torrents also worked correctly there. |
If torrents with piece size = 256MiB are not allowed to be created via RC_2_0 branch, then why are they allowed to be loaded/checked? If RC_2_0 branch truly supports (piece size = 256MiB) which in testing it previously had now issues, then creation should also be allowed. |
Please provide the following information
libtorrent version (or branch): RC_1_2
platform/architecture: Windows x64
compiler and compiler version: N/A
please describe what symptom you see, what you would expect to see instead and
how to reproduce it.
Torrent(s) with a (256.0MiB piece size) are causing users of qBittorrent/libtorrent 1.2.x based builds to experience crashes when checking.
See: qbittorrent/qBittorrent#21011 & qbittorrent/qBittorrent#19745, others.
RC_2_0 - Has no issue loading/checking these types of torrents.
RC_1_2/libtorrent 1.2.x based builds should not allow any torrent over it's supported limit of
128.0 MiB
to be loaded/checked etc.512MiB/1GiB
torrents are able to be loaded/get stuck on checking resume data even though qbittorrent logs stateinvalid piece
etc.With a (256.0MiB piece size) cache/total buffer increases & isn't freed which leads to pagefile/RAM being fully absorbed & eventual crash as system will run out of resources....this has happened even with a system that had
128 GiB RAM
installed. qbittorrent/qBittorrent#19745 (comment)I've attached below a number of torrents with (256.0MiB piece size) for testing:
256.0 MiB Torrents.zip
The text was updated successfully, but these errors were encountered: