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

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

Closed
psbj opened this issue Apr 22, 2015 · 11 comments
Closed

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

psbj opened this issue Apr 22, 2015 · 11 comments

Comments

@psbj
Copy link

psbj commented Apr 22, 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).

@chrishirst
Copy link
Contributor

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

@psbj
Copy link
Author

psbj commented 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.

@chrishirst
Copy link
Contributor

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

@psbj
Copy link
Author

psbj commented Apr 22, 2015

I had this problem with libtorrent 0.16.18 as well.

@sledgehammer999
Copy link
Member

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/

@psbj
Copy link
Author

psbj commented 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.

@sledgehammer999
Copy link
Member

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

@psbj
Copy link
Author

psbj commented Apr 22, 2015

@sledgehammer999
Copy link
Member

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 )

@psbj
Copy link
Author

psbj commented 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 psbj closed this as completed Apr 22, 2015
@sledgehammer999
Copy link
Member

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 up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants