qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
25.89k stars 3.82k forks source link

Memory Leak - Multiple WebUIs open simultaneously #20873

Open Jorsher opened 1 month ago

Jorsher commented 1 month ago

qBittorrent & operating system versions

qBittorrent: 4.6.4 x64 Operating system: TrueNAS Scale (Debian Bookworm) Qt: 6.7.0 libtorrent-rasterbar: 1.2.19

What is the problem?

I run multiple containers/instances of qbittorrent-nox on a server. I do not have hostnames, and access them by http://ip:port. They're all at the same IP with different ports.

If only one client is accessed at a time in the browser, there are no problems. Immediately after opening a second client in the browser, RAM usage by the clients on the host starts climbing rapidly until reaching OOM. If three are open, it occurs on all three. Memory usage in the browser (Firefox) accessing the clients also increases until OOM.

When I close the tabs, the memory is not released on the host. To release the memory, I need to restart the containers.

EDIT: Someone that had different IPs for the clients on the host did not experience the issue.

Steps to reproduce

  1. Access the web interface for two clients simultaneously
  2. Watch RAM usage by the clients on the host, and the tabs in the browser, increase until OOM

Additional context

No response

Log(s) & preferences file(s)

No response

Jorsher commented 1 month ago

https://github.com/qbittorrent/qBittorrent/issues/20675#issue-2231745577 seems to see the same issue

Chocobo1 commented 1 month ago

@Jorsher Are you able to reproduce with qbt v5?

Jorsher commented 1 month ago

I'll likely just wait until 5.0 is released. Spent a lot of time building it from source (boost, lt, qt6 as well), wasn't loading my existing torrents.db, and then trying to add a torrent manually was causing a crash. I'm sure that I either built it wrong or used the wrong version of a dependency (latest on all). I don't think the AppImage is an option since I run these headless.

Easy enough to just open one client at a time in the browser. A couple people I've asked with multiple clients:

dyno10 commented 1 month ago

I'll likely just wait until 5.0 is released. Spent a lot of time building it from source (boost, lt, qt6 as well), wasn't loading my existing torrents.db, and then trying to add a torrent manually was causing a crash. I'm sure that I either built it wrong or used the wrong version of a dependency (latest on all). I don't think the AppImage is an option since I run these headless.

Easy enough to just open one client at a time in the browser. A couple people I've asked with multiple clients:

  • one that access them through the same IP but different port encountered the same issue
  • one that accesses them through different IPs did not encounter the issue

I can confirm that accessing WebUI's via different subnets prevents memory leaks. I've updated my most recent post accordingly.

My qbit server has two IP's on separate subnets (192.168.0.xxx and 192.168.100.xxx), so I never got memory leaks when I had only two instances because each qbit instance was using a different subnet. Adding a third instance cause the memory leaks because it was using the same ip as another instance (different ports).

dyno10 commented 1 month ago

@Jorsher Are you able to reproduce with qbt v5?

I tested this in qbit v5 and was able to reproduce the issue. I tested it on Ubuntu Server 24.04 with the v5 .appimage posted on the qbit website.

dyno10 commented 1 month ago

Per my previous comment, here are two htop screenshots showing memory usage after having two WebUI sessions open simultaneously for over 28hr continuously. These qbit instances each has only a single 600MB torrent seeding (a Debian ISO) and it's not a very active torrent for me. These screenshots were taken roughly 18hr apart.

June 2:

qbit_leak_02_June

June 3:

qbit_leak_03_June