[Resource leak] Infinite folder creation loop on "Set location..." #4536

Closed
opened 2026-02-21 17:22:17 -05:00 by deekerman · 4 comments
Owner

Originally created by @JohnReynold on GitHub (Jul 19, 2016).

If a location inside the torrent's own folder is chosen in "Set location...", qbittorrent will be stuck in a loop of infinite (recursive?) folder/file creation until the filesystem reaches its limits. Restarting the client seems to fix it (qb doesn't remember the torrent should be moved, after the restart).

Steps for reproduction:

  • Have a torrent downloaded which has a root folder, eg. a folder named "Files".
  • Set location, select "Files" as the save folder.
  • Qb should create a new Files folder inside the current one and move things there. Instead, when checked from file explorer, Files will contain another Files folder, which will contain another one, and so on (the files are not moved from the previous location usually, it seems to get stuck with folder creation).
Originally created by @JohnReynold on GitHub (Jul 19, 2016). If a location inside the torrent's own folder is chosen in "Set location...", qbittorrent will be stuck in a loop of infinite (recursive?) folder/file creation until the filesystem reaches its limits. Restarting the client seems to fix it (qb doesn't remember the torrent should be moved, after the restart). Steps for reproduction: - Have a torrent downloaded which has a root folder, eg. a folder named "Files". - Set location, select "Files" as the save folder. - _Qb should create a new Files folder inside the current one and move things there._ **Instead, when checked from file explorer, Files will contain another Files folder, which will contain another one, and so on (the files are not moved from the previous location usually, it seems to get stuck with folder creation).**
deekerman 2026-02-21 17:22:17 -05:00
Author
Owner

@thalieht commented on GitHub (Jul 20, 2016):

I confirm but the way Set location... works: It moves the root folder, not the contents of the folder so its impossible, naturally, even in file explorer to move a folder inside one of it's subfolders.
Having said that i believe it to be a bug because it can make qbt hang, or can it? maybe because i'm on windows and the path can't be too long it didn't hang for me (v3.3.5).

You must have your reasons for wanting to move the contents of the folder into a subfolder but considering it would move everything inside the root folder (if it worked like that) it would simply create yet another folder to traverse in order to get to the contents. i can't think of any possible benefit this might provide (i.e can't sort the contents into subfolders).

@thalieht commented on GitHub (Jul 20, 2016): I confirm but the way Set location... works: It moves the root folder, not the contents of the folder so its impossible, naturally, even in file explorer to move a folder inside one of it's subfolders. Having said that i believe it to be a bug because it can make qbt hang, or can it? maybe because i'm on windows and the path can't be too long it didn't hang for me (v3.3.5). You must have your reasons for wanting to move the contents of the folder into a subfolder but considering it would move everything inside the root folder (if it worked like that) it would simply create yet another folder to traverse in order to get to the contents. i can't think of any possible benefit this might provide (i.e can't sort the contents into subfolders).
Author
Owner

@JohnReynold commented on GitHub (Jul 20, 2016):

it can make qbt hang, or can it?

It causes high CPU and I/O usage until the eventual crash or exception by the file system. Also litters with junk folders.

it would move everything inside the root folder

But that's not exactly how it normally works? If there are files/folders inside the root folder of the torrent that do not belong to it, those are never moved or deleted along with the rest, to my knowledge? So it can't be just simply moving folders?

so its impossible, naturally,

If it's impossible to do the user should just not be allowed to try doing it, especially when it does not have the result a normal user would expect.

I guess the solution would be to not actually move folders, only files (and recreate the expected folder structure before moving files).

@JohnReynold commented on GitHub (Jul 20, 2016): > it can make qbt hang, or can it? It causes high CPU and I/O usage until the eventual crash or exception by the file system. Also litters with junk folders. > it would move everything inside the root folder But that's not exactly how it normally works? If there are files/folders inside the root folder of the torrent that do not belong to it, those are never moved or deleted along with the rest, to my knowledge? So it can't be just simply moving folders? > so its impossible, naturally, If it's impossible to do the user should just not be allowed to try doing it, especially when it does not have the result a normal user would expect. I guess the solution would be to not actually move folders, only files (and recreate the expected folder structure before moving files).
Author
Owner

@thalieht commented on GitHub (Jul 20, 2016):

But that's not exactly how it normally works? If there are files/folders inside the root folder of the torrent that do not belong to it, those are never moved or deleted along with the rest, to my knowledge? So it can't be just simply moving folders?

I just made a folder and a .txt file inside the root folder of a torrent and then Set location... and it moved everything. Then i deleted the torrent and its data from qbt and it deleted the contents of the torrent + the folder i made but not the .txt file.

@thalieht commented on GitHub (Jul 20, 2016): > But that's not exactly how it normally works? If there are files/folders inside the root folder of the torrent that do not belong to it, those are never moved or deleted along with the rest, to my knowledge? So it can't be just simply moving folders? I just made a folder and a .txt file inside the root folder of a torrent and then Set location... and it moved everything. Then i deleted the torrent and its data from qbt and it deleted the contents of the torrent + the folder i made but not the .txt file.
Author
Owner

@sledgehammer999 commented on GitHub (Oct 29, 2020):

This issue has been closed and locked for being too old, and thus either most likely resolved in recent versions or no longer applicable.
If you experience the reported problem or similar in the latest version, please open a new issue report with the requested information in the issue template.

A new issue report with relevant updated data gathered from the latest version is preferable to necroing an old report with a comment like "still happens in version x.y.z", even if you think the bug is the same, or suspect of a regression.
Due to the changes made to the qBittorrent code and its dependencies over time, the exact cause of your problem could be totally different than the original one, despite the visible symptoms of the bug being similar.
Thus, providing relevant updated information is crucial to find and fix the root cause of a recurrent problem or regression.

Thank you for your contributions.

@sledgehammer999 commented on GitHub (Oct 29, 2020): This issue has been closed and locked for being too old, and thus either most likely resolved in recent versions or no longer applicable. If you experience the reported problem or similar in the **latest** version, please open a new issue report with the requested information in the issue template. A new issue report with relevant updated data gathered from the latest version is preferable to necroing an old report with a comment like "still happens in version x.y.z", even if you think the bug is the same, or suspect of a regression. Due to the changes made to the qBittorrent code and its dependencies over time, the exact cause of your problem could be totally different than the original one, despite the visible symptoms of the bug being similar. Thus, providing relevant updated information is crucial to find and fix the root cause of a recurrent problem or regression. Thank you for your contributions.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/qBittorrent#4536
No description provided.