-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
WebUI: Memory Leak when multiple WebUIs are open simultaneously #20873
Comments
#20675 (comment) seems to see the same issue |
@Jorsher |
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:
|
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). |
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. |
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. |
Is there any progress on resolving this within qbittorrent rather than creating additional subnets, or the actual root cause of why running 2 qbt daemons on the same subnet but different ports causes the memory leak? |
Hi, I've recently encountered the same issue. In addition to what was already mentioned, WebUIs from different qBittorrent instances seem to interfere between eachother in regard of rid that's being sent with maindata request to API, thus resetting it to 1 every time. But when only one WebUI instance is opened rid increments normally.
In corresponding responses rid is also set to 1. Related problem: this unticks tag checkboxes in torrent context menu, allowing to add but not remove tag from torrent (if you're not fast enough). Software versions: (Sorry if this brings no value.) |
Profiling the code paths for a client running with 1000+ torrents would be the way to go for solving this issue because I honestly don't believe 5.0.0 is better, I accidentally updated to 5.0.0 and WebUI was still 30+ sec to load and still felt unresponsive. I had to go down to 400-600 torrents before it was responsive again, but I mean.. It still feels sluggish at all times, really.. |
I made many tests, and it seems like the problem lays in two things:
qbt.mp4I created a version, in which the cookie name is appended with the WebUI port number. This way the two instances won't conflict with each other. Feel free to check out the patched version. You can grab an artifact from the finished actions. I pushed a linux/amd64 docker image based on the official image. You can try it out: If it works out I'll send a PR. Side notes: |
@dyseg Thank you for your work diagnosing this bug and hopefully arriving at a resolution, finally! I'm testing your fix now and will report back. For clarity, the patches were applied to 5.1.0alpha1-r12955-git+2d185dc1c git master, built against libtorrent-rasterbar 2.0.11-r13797-git+a3cdc5107 (compiled from RC_2_0 branch). |
I can confirm your fix appears to have resolved this bug. I've been running webuis for 3 separate -nox instances in the same browser for a day straight now and no memory leak! Prior to your fix this would've resulted in 100% memory usage and a total system freeze. Thank you again for diagnosing and fixing this! |
As noted in #21619 (comment), when accessing multiple qBittorrent instances via the same hostname/IP address, you should give each qBittorrent instance a unique cookie name (#18384). I was not aware of this, but it makes sense: overwriting the cookie will lead to starting a new session, which means doing more work like sending down a full maindata snapshot. |
Appending the instance's session cookie name with the instance's webui port creates a unique cookie name, right? |
Indeed it does. |
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
Additional context
No response
Log(s) & preferences file(s)
No response
The text was updated successfully, but these errors were encountered: