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

All torrents redownload or recheck on reboot #15381

Open
Wolfeman0101 opened this issue Aug 27, 2021 · 6 comments
Open

All torrents redownload or recheck on reboot #15381

Wolfeman0101 opened this issue Aug 27, 2021 · 6 comments

Comments

@Wolfeman0101
Copy link

Running v4.3.7 on TrueNAS in a jail. When I reboot my system all of my torrents are either checking or redownloading and some of them are using the default download location not the one I set in the config. It's like it forgets where the files are.

@shama84
Copy link

shama84 commented Aug 27, 2021

I get such behaviour in previous setup so just want to add the hypothesis: is the filesystem ready (available) when QBT start?
I make the assumption you use QBT-nox with a systemd unit (or auto start at least).
My solution in its time was simply to add a systemd dependency (Requires=$filesystem_unit_name).

Testing is easy: start the program /unit manually after the reboot prior first browsing the files to confirm they are reachable.
Does it sound like a possibility?

@glassez
Copy link
Member

glassez commented Aug 27, 2021

It looks like It looks like .fastresume files corruption during system shutdown (e.g. because your system can't wait until qBittorrent exits). Can you check/confirm this? However, to do this, you need to shut down the system, and then check the .fastresume files (e.g. for zero-size files) without starting qBittorrent.

@The5kull
Copy link

The problem that occurs lately again is that it takes qB too long to quit completely. If you reboot your system in that time and qB has not closed completely then you are heading into OP's hell. Always check in task manager if qB closed completely before doing reboots.

@Kolcha
Copy link
Contributor

Kolcha commented Sep 2, 2021

I faced the same annoying issue long time ago (~2018) when I had even only about 300 torrents on my server (now there are ~2000 torrents, and 50-100 are active in any point of time).

yes, this is related to .fastresume files, that are become corrupted in case of unclean qBittorrent exit. to be more precisely, as it was mentioned above, .fastresume files have zero-size files. fixing file sizes in .fastresume files before qbittorrent launch avoids rechecking/re-downloading.

I'm using qbittorrent-nox on Linux (more than 2 years on Debian unstable yet, previously on Ubuntu and Arch), I solved this issue just by creating simple bash script which waits for qBittorrent clean exit, set this script as ExecStop command for qBittorrent' systemd unit, and ask systemd to wait for qBittorrent process stop about 5 minutes (this is more than enough, even with my ~2k torrents and very slow flash drive used as system root disk where qbittorrent data is saved, even in worst cases I saw only about 3 minutes delay). usually qbittorrent shutdown took about 1-1.5 min in my case, but since some update somewhere near to 4.3.0 this time was even reduced up to 30 sec.

the script I use is below:

#!/bin/bash

exe_name="qbittorrent-nox"

kill -s SIGINT $(pgrep ${exe_name})

while (pgrep ${exe_name} > /dev/null)
do
  sleep 2
done

I don't know what TrueNAS is, but I'm almost sure that in uses some kind of Linux or at least Unix-like system, so the only one thing that must be done to overcome this issue is just to find what and how launches apps/daemons (i.e. systemd on many Linux systems) and the way to customize this process (i.e. add script to wait for completion).

@Wolfeman0101
Copy link
Author

TrueNAS is based on FreeBSD. I'll try this out thanks.

Chocobo1 added a commit to Chocobo1/qBittorrent that referenced this issue Sep 3, 2021
The default was 90s[1], prolong to 30 mins.
From the discussion in [2], ~2k torrents took 5 mins to completely
shutdown. Here we wait at most 30 mins which scales to about 12k
torrents which should cover most use case (also note that 4.3.x series
is mentioned to have even shorter shutdown time).

[1] https://www.freedesktop.org/software/systemd/man/systemd-system.conf.html#DefaultTimeoutStartSec=
[2] qbittorrent#15381 (comment)
Chocobo1 added a commit that referenced this issue Sep 4, 2021
The default was 90s[1], prolong to 30 mins.
From the discussion in [2], ~2k torrents took 5 mins to completely
shutdown. Here we wait at most 30 mins which scales to about 12k
torrents which should cover most use case (also note that 4.3.x series
is mentioned to have even shorter shutdown time).

[1] https://www.freedesktop.org/software/systemd/man/systemd-system.conf.html#DefaultTimeoutStartSec=
[2] #15381 (comment)

PR #15414.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@Kolcha @Wolfeman0101 @glassez @shama84 @The5kull and others