QbitTorrent keeps crashing/hanging

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version | cat /boot/dietpi/.version
  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
  • Kernel version | uname --all
  • Architecture | dpkg --print-architecture
  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)
  • Power supply used | (EG: 5V 1A RAVpower)
  • SD card used | (EG: SanDisk ultra)

Additional Information (if applicable)

  • Software title | (EG: Nextcloud)
  • Was the software title installed freshly or updated/migrated?
  • Can this issue be replicated on a fresh installation of DietPi?
    ← If you sent a “dietpi-bugreport”, please paste the ID here →
  • Bug report ID | echo $G_HW_UUID

Steps to reproduce

Just running qbittorrent-nox after a little while just hangs my PI

Expected behaviour

Should keep running

Actual behaviour

Crashes or hangs the PI

Extra details

Logs do not show anything, the amount of time between reset and crash is pretty much random.
DietPI version 5.2.2
QBitTorrent version 5.1.0 64 bit
Anyone else having similar issues?

root@DietPi:~# cat /boot/dietpi/.version
G_DIETPI_VERSION_CORE=10
G_DIETPI_VERSION_SUB=5
G_DIETPI_VERSION_RC=2
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
root@DietPi:~# echo $G_DISTRO_NAME $G_RASPBIAN
trixie 0
root@DietPi:~# uname --all
Linux DietPi 6.18.34+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.18.34-1+rpt1 (2026-06-09) aarch64 GNU/Linux
root@DietPi:~# dpkg --print-architecture
arm64
Power Supply: 100w
SD Card Used: USB SSD Drive.

Which RPi model is it? Quick guess would be exhausted memory or low voltage during preak usage, e.g. when download and a flush from buffer to disk comes together or so. But it is difficult to know without logs. You do not have a screen attached to catch kernel errors at, do you?

Else enable permanent system logs:

dietpi-software uninstall 103
sudo mkdir /var/log/journal
sudo systemctl stop dietpi-ramlog
sudo umount /var/log && sudo /boot/dietpi/func/dietpi-ramlog 0
sudo reboot

Pi 3 with 1GB ram. I created a 1.5 GB swap space.

I do have a screen attached, but nothing shows up on it. I have the logs going to a non-volatile disk space. I have looked in the logs, everything is pretty much normal tasks (torrents completing). The the start up tasks start listing off in the log. No other error messages in the logs.

I ran what you suggested. Will post the logs here as soon as something gets written.

Relevant would be the kernel logs, i.e. the systemd journal, or rsyslog to fetch and store them in plain text log files.

But if the HDMI screen is not showing anything, then the system logs most likely won’t either, as systemd feeds both from the kernel ring buffer.

You could monitor things like RAM usage and CPU temperature on a dedicated SSH session or so. Also check for kernel errors earlier, like when a download started, so some disk I/O happened already:

dmesg -l 0,1,2,3
vcgemcmd get_throttled

The second show whether there was some undervoltage or frquency cap during the session, with 0x0 meaning everything is fine: https://www.raspberrypi.com/documentation/computers/os.html#get_throttled

EDIT: What boot media are you using, and what drive is qBittorrent downloading to? Maybe the shared 1.2A USB power limit causes issues, if you are using a larger (than a stick/thumb) USB drive.

root@DietPi:~# dmesg -l 0,1,2,3
vcgemcmd get_throttled
[   14.966390] Bluetooth: hci0: BCM: firmware Patch file not found, tried:
[   14.968545] Bluetooth: hci0: BCM: 'brcm/BCM4345C0.raspberrypi,3-model-b-plus.hcd'
[   14.970525] Bluetooth: hci0: BCM: 'brcm/BCM4345C0.hcd'
[   14.973356] Bluetooth: hci0: BCM: 'brcm/BCM.raspberrypi,3-model-b-plus.hcd'
[   14.975558] Bluetooth: hci0: BCM: 'brcm/BCM.hcd'
-bash: vcgemcmd: command not found

root@DietPi:~# vcgencmd get_throttled
throttled=0x0

Greg

I run the same version on a RPi 4 with 4GB of memory and do not experience this issue.

It’s a typo, the correct command is

vcgencmd get_throttled

Right thanks, a typo my end. The missing Bluetooth firmware blob is interesting (if firmware-brcm80211 is installed, which is from RPi Ltd’s own APT repository), but unrelated.

Could be a memory issue. I have slowly increased the swap size, and the crashing is less frequent. Did confirm the PI has 1GB of memory, so out of memory would make sense.

In that case it is interesting that qBittorrent consumes so much, or is there something else running?

Maybe some caching settings need to be tuned. I recently tested Transmission, at that did not go above 70 MiB with multiple downloads and parallel seeding running. It seems to use a small network-side buffer, otherwise relies on native filesystem read/write cache/buffer, which seems reasonable to me on Linux.

Yup think I am going to have to take a serious look at Transmission. Seems there is a lot of stuff in QBitTorrent that I do not need/use.

Indeed qBittorrent behaves badly:

  • I added a single torrent, the Debian DVD image: https://cdimage.debian.org/debian-cd/current/amd64/bt-dvd/debian-13.6.0-amd64-DVD-1.iso.torrent
  • It connects to peers quickly and maxes out my bandwidth, so all good in this regards.
  • No upload done, surely also because I do not forward the port, and qBittorrent seems to actively connect to peers for seeding only if the download is done (happened just now, indeed now upload starts), or in case of low download activity.
  • We apply Downloads\DiskWriteCacheSize=<10% of physical RAM size>, but I do not see this in the web UI settings, maybe this setting is obsolete. Also, I do not see a reason to use such a potentially still huge write cache. We should probably remove it. But that alone would still not be a huge issue.
  • But I do see this:
    {480A0D2C-5EA3-4890-A300-8CFF3F20E6DF}
  • Despite that, qBittorrent seems to download the entire download of a torrent into memory. It raised continuously during the download. The size of the DVD is slightly lower than the RAM size of the test VM, so it finished before I could see whether it runs into OOM or not. After it finished, RAM usage dropped to expected ranges instantly. So it really was that download that got cached somehow, being written to disk after finish. That is nonsense.
  • Furthermore, even long before memory went significantly full, CPU usage was 400% (on 4 cores) by times, and htop in the SSH session stalled by times, as well as the web UI. Like when I tried to open “Options”, it loaded endlessly, progress stats did not update, and I needed to reload the whole website to restore things.

I cannot find a documentation with a list of all config file settings :thinking:. Saving settings in the web UI seems to add valid ones, but not remove invalid ones. Here are some in the source code, but it does not contain all of them: qBittorrent/src/base/preferences.cpp at 0c6756f703b28d44a1c35bd18be95cada83d5cf5 · qbittorrent/qBittorrent · GitHub
E.g. Session\DiskCacheSize was added, copying the value from our Downloads\DiskWriteCacheSize. But that setting does not appear in prior file.

Ah, here is the list of changed (and auto-migrated) settings: qBittorrent/src/app/upgrade.cpp at 0c6756f703b28d44a1c35bd18be95cada83d5cf5 · qbittorrent/qBittorrent · GitHub
Indeed the old settings just remain in the config file, too. There is actually an “auto” value which we should use instead: Change some settings defaults for better behaviour out of the box · qbittorrent/qBittorrent@30502de · GitHub
I’ll retest with that, but a disk cache of 391 MiB does not explain the >3 GiB memory usage, which looks like there was no limit at all.

So the settings which can be changed via GUI are in qBittorrent/src/base/preferences.cpp at 0c6756f703b28d44a1c35bd18be95cada83d5cf5 · qbittorrent/qBittorrent · GitHub, but other settings which can be changed in the config file only, are distributed among other files in qBittorrent/src at master · qbittorrent/qBittorrent · GitHub, which can be roughly derived from the settings name and section.

EDIT: Retesting with a larger Ubuntu image that could exceed the VMs RAM. With DiskCacheSize=-1 (auto), it still downloads into RAM without limit so far. But at the same time, the true data seems to be written to disk as well. The file is pre-allcocated with full 6.1 GiB size, but sparse. But the true data is written as well, as can be monitored:

2026-07-30 17:37:55 root@VM-Trixie:/mnt/dietpi_userdata/downloads# du -sm ubuntu-26.04-desktop-amd64.iso
997     ubuntu-26.04-desktop-amd64.iso
2026-07-30 17:37:59 root@VM-Trixie:/mnt/dietpi_userdata/downloads# du -sm ubuntu-26.04-desktop-amd64.iso
1002    ubuntu-26.04-desktop-amd64.iso
2026-07-30 17:38:00 root@VM-Trixie:/mnt/dietpi_userdata/downloads# du -sm ubuntu-26.04-desktop-amd64.iso
1005    ubuntu-26.04-desktop-amd64.iso
2026-07-30 17:38:01 root@VM-Trixie:/mnt/dietpi_userdata/downloads# du -sm ubuntu-26.04-desktop-amd64.iso
1009    ubuntu-26.04-desktop-amd64.iso
2026-07-30 17:38:02 root@VM-Trixie:/mnt/dietpi_userdata/downloads# l ubuntu-26.04-desktop-amd64.iso
-rw-rw-r-- 1 qbittorrent dietpi 6.1G Jul 30 17:38 ubuntu-26.04-desktop-amd64.iso

So I have no idea why it is kept in memory as well.

EDIT2: Ah, here is a related bug report at Debian: https://bugs.debian.org/1111237
No answer. We need to test this on Bookworm and Forky, and with empty/default config, to pin-point it to a certain version and/or setting. The bug report indicates it appeared in Trixie, resp. between qBittorrent v4.5.2 and v5.1.0.

Nasty is that there is no source repo link in the package, and the source does not seem to be at Salsa (Debian’s GitLab instance). It was, but all related repos are out of date, hence it is now hosted elsewhere: https://salsa.debian.org/search?search=qbittorrent

Ohh wait a second: This is a misinterpretation, though also weirdly implemented:

  • In htop etc it really looks like the process eats 4 GiB:
    {9E5F638D-68A9-4E31-85B7-D4B4B7F076CC}
  • But it can be seen that this is all just filesystem cache:
    {E397F1C8-E5A5-4872-AACD-FA5364E1F48D}
  • The 3.5 GiB are not actually occupied:
    2026-07-30 17:51:58 root@VM-Trixie:/mnt/dietpi_userdata/downloads# free -m
                   total        used        free      shared  buff/cache   available
    Mem:            3919         470         149          64        3616        3449
    Swap:              0           0           0
    
  • Also the download is now at > 5 GiB, while memory usage of the process remains at ~3.5 GiB. So it just filled the native filesystem cache, which is perfectly fine, and now that RAM is “full”, the earlier cache entries are freed.
  • The only uncommon thing is that usually, cache/buffer usage does not appear in the process list. Somehow qBittorrent uses the cache a way that its usage stays attached to the process. I remember this from the vmtouch tool, which can be used to actively move and evict files from filesystem cache. And it can be started as service to keep certain files or dirs in the cache. When doing so, the used cache size is also shown as used by the vmtouch process.

However, this means it shouldn’t ever run OOM. The bug report is about a qBittorrent instance running in a container. Those have their own memory/resource limit enforcement via cgroups on the host. And I can imagine, that with the filesystem cache usage attached to the process that way, the memory cgroup limits might misinterpret this. Or the container engine might occupy it at the host as if it was not just the filesystem cache.

@GregoryWest501
Can you confirm, that while memory usage of the qbittorrent-nox process in htop looks high, free -h shows most of this below buff/cache, with enough left below available? And does it max out CPU usage as well when maxing out your download bandwidth? In my case, with the Ubuntu torrent download, I couldn’t max out my bandwidth, and CPU usage dropped to half as well, compared to the max/max Debian torrent download. So if whichever part of the download/store chain causes too high CPU usage in case of high transfer rates, a solution would be to limit those via GUI, and/or reduce the priority of the process in dietpi-services, so SSH and other things may remain more responsive.