Qbittorrent-nox rechecks/rehashes all torrents when restarted #2391

Closed
opened 2026-02-21 16:11:31 -05:00 by deekerman · 11 comments
Owner

Originally created by @psbj on GitHub (Apr 21, 2015).

I'm using qbittorrent-nox with the webui on a headless installation of debian.

I used the build through apt-get previously (3.1.10) and today I tried out 3.2.0beta and the issue is still there. This was also an issue when I was running qbittorrent-nox on my raspberry pi (raspbian).

Whether it's stopped by a loss of power, intended shutdown, daemon stopping, or "exit qbittorrent" in the webui menu, all torrents are forced to recheck when it's started again.

This is a huge problem for people with a lot or very large torrents (or both).

Originally created by @psbj on GitHub (Apr 21, 2015). I'm using qbittorrent-nox with the webui on a headless installation of debian. I used the build through apt-get previously (3.1.10) and today I tried out 3.2.0beta and the issue is still there. This was also an issue when I was running qbittorrent-nox on my raspberry pi (raspbian). Whether it's stopped by a loss of power, intended shutdown, daemon stopping, or "exit qbittorrent" in the webui menu, all torrents are forced to recheck when it's started again. This is a huge problem for people with a lot or very large torrents (or both).
Author
Owner

@chrishirst commented on GitHub (Apr 22, 2015):

What version of libtorrent is it built against?
See #2750 (and #2853)

@chrishirst commented on GitHub (Apr 22, 2015): What version of libtorrent is it built against? See #2750 (and #2853)
Author
Owner

@psbj commented on GitHub (Apr 22, 2015):

Currently it's libtorrent 1.0.4, but previously it was libtorrent 0.16.18.

I tried compiling earlier versions of libtorrent but it says it's missing boost_system or something, even though it's not. 1.0.4 has non issues compiling.

@psbj commented on GitHub (Apr 22, 2015): Currently it's libtorrent 1.0.4, but previously it was libtorrent 0.16.18. I tried compiling earlier versions of libtorrent but it says it's missing boost_system or something, even though it's not. 1.0.4 has non issues compiling.
Author
Owner

@chrishirst commented on GitHub (Apr 22, 2015):

Okay I would suggest that this is starting to point to a libtorrent problem in v1.03 and above.

@chrishirst commented on GitHub (Apr 22, 2015): Okay I would suggest that this is starting to point to a libtorrent problem in v1.03 and above.
Author
Owner

@psbj commented on GitHub (Apr 22, 2015):

I had this problem with libtorrent 0.16.18 as well.

@psbj commented on GitHub (Apr 22, 2015): I had this problem with libtorrent 0.16.18 as well.
Author
Owner

@sledgehammer999 commented on GitHub (Apr 22, 2015):

Can you check the contents of "BT_backup" folder? When you close qbt, are .fastresume files created in there?
Can you alsos check the permissions of that folder and its contents?
You'll find this folder in $HOME/.local/share/data/qBittorrent/

@sledgehammer999 commented on GitHub (Apr 22, 2015): Can you check the contents of "BT_backup" folder? When you close qbt, are .fastresume files created in there? Can you alsos check the permissions of that folder and its contents? You'll find this folder in `$HOME/.local/share/data/qBittorrent/`
Author
Owner

@psbj commented on GitHub (Apr 22, 2015):

I just checked and there are .torrent and .fastresume files there. I started qbittorrent-nox and it resumed the torrents without problem.

This is weird, because I tested last night and it was rechecking all the torrents once I restarted the service.

Not sure what has changed but it appears to be working fine now. Strange.

@psbj commented on GitHub (Apr 22, 2015): I just checked and there are .torrent and .fastresume files there. I started qbittorrent-nox and it resumed the torrents without problem. This is weird, because I tested last night and it was rechecking all the torrents once I restarted the service. Not sure what has changed but it appears to be working fine now. Strange.
Author
Owner

@sledgehammer999 commented on GitHub (Apr 22, 2015):

Can you share the script that starts/restarts/stops the qbt service?

@sledgehammer999 commented on GitHub (Apr 22, 2015): Can you share the script that starts/restarts/stops the qbt service?
Author
Owner
@psbj commented on GitHub (Apr 22, 2015): It's the one in the wiki: https://github.com/qbittorrent/qBittorrent/wiki/Running-qBittorrent-without-X-server#how-to-run-qbittorrent-nox-on-startup
Author
Owner

@sledgehammer999 commented on GitHub (Apr 22, 2015):

Your problem may arise during system shutdown if you have many torrents in qbt.
Note: I am not very good with bash and linux scripting in general.
Look at the do_stop() function of the script you linked.

start-stop-daemon -c $USER --quiet --stop --exec $DAEMON

The above sends a SIGTERM signal to qbt which is ok. When qbt receives this, it starts shutting down by first trying to save the fastresume files. However this can take several seconds if you have many torrents. In fact even if you only 2-3 it may take at least 3 seconds to close.
So the sleep 2 may not be enough. Only 2 seconds.
So during system shutdown, the service is supposedly stopped after ~2 when in fact qbt may still be running in the background. And since the script reported that the service is stopped, the OS shutdown continues and at some point it kills qbt.

The above is just a speculation. I may be totally wrong.
IMO, after the sleep there should a check of the running processes. If qbt is still running is should sleep again for 2 secs.
So putting the sleep in a while loop that checks for running qbt should suffice. (Don't expect any bash code from me though :P )

@sledgehammer999 commented on GitHub (Apr 22, 2015): Your problem may arise during system shutdown if you have many torrents in qbt. Note: I am not very good with bash and linux scripting in general. Look at the do_stop() function of the script you linked. > start-stop-daemon -c $USER --quiet --stop --exec $DAEMON The above sends a SIGTERM signal to qbt which is ok. When qbt receives this, it starts shutting down by first trying to save the fastresume files. However this can take several seconds if you have many torrents. In fact even if you only 2-3 it may take at least 3 seconds to close. So the `sleep 2` may not be enough. Only 2 seconds. So during system shutdown, the service is supposedly stopped after ~2 when in fact qbt may still be running in the background. And since the script reported that the service is stopped, the OS shutdown continues and at some point it kills qbt. The above is just a speculation. I may be totally wrong. IMO, after the sleep there should a check of the running processes. If qbt is still running is should sleep again for 2 secs. So putting the sleep in a while loop that checks for running qbt should suffice. (Don't expect any bash code from me though :P )
Author
Owner

@psbj commented on GitHub (Apr 22, 2015):

Considering I have over 500 torrents I think it's safe to say that's the problem. Thanks for the help!

@psbj commented on GitHub (Apr 22, 2015): Considering I have over 500 torrents I think it's safe to say that's the problem. Thanks for the help!
Author
Owner

@sledgehammer999 commented on GitHub (Apr 22, 2015):

The man page for start-stop-daemon: http://manpages.ubuntu.com/manpages/lucid/en/man8/start-stop-daemon.8.html

You should add --retry 120 to the above command. It should recheck if qbt has finished before returning. And it should recheck continously for 2minutes. After 2 minutes it will error out.

@sledgehammer999 commented on GitHub (Apr 22, 2015): The man page for start-stop-daemon: http://manpages.ubuntu.com/manpages/lucid/en/man8/start-stop-daemon.8.html You should add `--retry 120` to the above command. It should recheck if qbt has finished before returning. And it should recheck continously for 2minutes. After 2 minutes it will error out.
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#2391
No description provided.