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

v4.4.0 memory leak #16166

Closed
shirepirate opened this issue Jan 18, 2022 · 72 comments
Closed

v4.4.0 memory leak #16166

shirepirate opened this issue Jan 18, 2022 · 72 comments

Comments

@shirepirate
Copy link

qBittorrent & operating system versions

qBittorrent: 4.4.0 x64
Operating System: Windows 10 Pro 21H2 x64 19044.1469
Qt: 5.15.2

What is the problem?

A memory leak occurs whenever I check data from a newly added torrent or choose to recheck data from a torrent already added, it fills up until it uses all system RAM and then resets back to normal RAM usage when a new torrent begins checking, repeating the process.

Steps to reproduce

  1. Have a torrent's complete data contents
  2. Add the torrent and begin checking the data
  3. Memory leak occurs

Additional context

https://i.imgur.com/plMQSjU.png

Under Working Set (KB), this is far, far greater RAM usage than qBittorrent ever has any business using.

https://i.imgur.com/Ny5hNU7.png

I included the 2nd screenshot so you can see how it gradually increases and doesn't stop until it reaches 99% system RAM usage.

Then, as described, once the torrent has checked out it resets the RAM usage and begins another memory leak once a new torrent begins checking or rechecking.

https://i.imgur.com/xuk5wvY.png

(last context image)

Log(s) & preferences file(s)

No response

@klepiku
Copy link

klepiku commented Jan 18, 2022

win 7 , 25 gb RAM , 99 %
the same thing happens when the torrent is downloaded and there is a check mark after
the leak occurs in parts of 16 mb

@jagannatharjun
Copy link
Member

jagannatharjun commented Jan 18, 2022

I also had a similar problem, when I had Advanced Option > File Pool Size set to ~5000, setting that to something reasonable like 44 fixed it for me. AFAIR some places advised to set this option pretty high but that won't work right for libtorrent 2.

@RedSnt
Copy link

RedSnt commented Jan 18, 2022

Bought a new PC with 64 GB of ram to avoid running out of memory, but then I woke up to qBittorrent using over 55GB of ram (maxed out ram usage on the system, everything chugging). Only experimental stuff I had enabled was the SQLite DB feature.
I'll try @jagannatharjun's tip and hope it relieves the stress.

@klepiku
Copy link

klepiku commented Jan 18, 2022

file Pool Size

https://imageban.ru/show/2022/01/18/dec5367b29c6dd78087c1ad281df5a76/jpg

the leak is both without sql and with it, but with sql it is faster

@mazzz1y
Copy link

mazzz1y commented Jan 18, 2022

have this problem too

@Legendarion
Copy link

Same problem here on Windows 7 SP1 x64, qB v4.4.0. The OS becomes slow/sluggish.
And the CPU/chassis fans runs faster at the same time.

@shirepirate
Copy link
Author

shirepirate commented Jan 18, 2022

I tried @jagannatharjun's method and reduced file pool size to 50, then started rechecking a very large torrent, and this worked.

I could still see the RAM usage begin to steadily rise, but every now and then it would drop down a substantial portion and never got anywhere close to a ridiculous level before completing.

This fixed the issue for me but not sure if that means the issue is really solved or not. Will leave to a contributor to close it.

@klepiku
Copy link

klepiku commented Jan 19, 2022

it doesn't help on win7
the leak is here somewhere https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-memory_priority_information
I suggest adding a shutdown for windows 7

@GANNER-dsxxx
Copy link

The same thing on Windows 7 x64
Screenshot_1

@TheFinalCut83
Copy link

Not a qbittorrent bug. I hope devs will remove libtorrent 2 support in 4.4.1 until libtorrent's memory leak problem will be solved. Same problem on my Win 7 x64 (32GB of RAM).

@Evernow
Copy link

Evernow commented Jan 20, 2022

Cannot reproduce on Windows 10, works fine here.

@klepiku
Copy link

klepiku commented Jan 20, 2022

the leak is slow if more than 80 gb of torrent, windows 7,part 16

@TheFinalCut83
Copy link

Cannot reproduce on Windows 10, works fine here.

Highly reproduceable on torrents with great amout of files and size around 40+ Gb.

@Evernow
Copy link

Evernow commented Jan 20, 2022

Cannot reproduce on Windows 10, works fine here.

Highly reproduceable on torrents with great amout of files and size around 40+ Gb.

Have multiple torrents in the 500GB to 1TB range. I counted a dozen in the 40gb range. No issues on W10

@TheFinalCut83
Copy link

Have multiple torrents in the 500GB to 1TB range. I counted a dozen in the 40gb range. No issues on W10

So you are lucky =) @shirepirate reproduced this problem on Windows 10 Pro 21H2.

@Evernow
Copy link

Evernow commented Jan 20, 2022

Have multiple torrents in the 500GB to 1TB range. I counted a dozen in the 40gb range. No issues on W10

So you are lucky =) @shirepirate reproduced this problem on Windows 10 Pro 21H2.

He is the only one who could reproduce this on W10, and it's possible it's a completely different issue.

Hopefully with qbittorrent ending Windows 7 support in the next major release these issues end.

@TheFinalCut83
Copy link

@HanabishiRecca
Copy link
Contributor

I hope devs will remove libtorrent 2 support in 4.4.1 until libtorrent's memory leak problem will be solved. Same problem on my Win 7 x64 (32GB of RAM).

qB 4.4.0 still support and can be built with libtorrent 1.x. This is what I have done for myself. (But for Windows users building it from the source is fairly complicated task though.)
So this is just about asking the devs to provide another installer variation.

@Iriman83
Copy link

Same leak here. Running qbittorrent-nox on arch 5.16.1. went to bed last night after a fresh reboot, woke up to it using 63% of available memory. Hope they fix it soon.

@LiaNdrY
Copy link

LiaNdrY commented Jan 22, 2022

Windows 10 Pro x64 21H1 (19043.1469)
Installed 32 GB of RAM, gradually fills all the memory during the normal work of downloading/uploading files.
qBittorrent x64 v4.5.0 alpha 1 (libtorrent v1.2.15)

@linax3-genuine
Copy link

just verified a 12GB torrent. the hard disk usage was very bad. hdd sounded bad, run at 100% and was doing only reading at very low speed. everything related to that drive was disturbed. 16gb ram almost filled by the process.

@ilyvasile
Copy link

ilyvasile commented Jan 29, 2022

image

Setting this options values helped a lot with 100% HDD usage issue while seeding 20GB+ torrents. Also, for good perfomance in other applications on same storage i suggest IO threads/process background mode, as described in #15597. Works perfect, even with mem mapped files in libtorrent 2.

@linax3-genuine
Copy link

linax3-genuine commented Jan 29, 2022

that is something, i have never tweaked and i dont remember having any problems with it.
i have clearly broken software, caused by the update.
my settings are: 500K; 10K; 50%;
did this update made any changes related to those buffers? and how it is related to verifying torrents?

@TheFinalCut83
Copy link

Setting this options values helped a lot with 100% HDD usage issue

Looks like not a very good "crutch". Crank up the application buffer by 16 times due to a bug in the library... I suggest waiting for the comments of the author of libtorrent (and his fixes for it), staying on 4.3.9.

@HanabishiRecca
Copy link
Contributor

just verified a 12GB torrent. the hard disk usage was very bad. hdd sounded bad, run at 100% and was doing only reading at very low speed. everything related to that drive was disturbed. 16gb ram almost filled by the process.

Are you sure this is related? Do you have pagefile on HDD? Make some pagefile monitoring if you can (e.g. as described here).
And if the memory pressure actually causes swapping to the disk, please post your results here: arvidn/libtorrent#6667

@linax3-genuine
Copy link

im not sure, if my issue is related to a memory leak. only observed what task manager shows - (working sets increase) memory gets apparently endlessly filled because of that verification.
along with the strange(apparently harmful) usage of the hard drive.
monitoring qbittorrent with process manager is impossible, while verify is running, as qbt properties window freezes.
i dont want to brake my hdd, so im not going to do any more testing.
my pagefile is on a ssd, if that matters.
maybe its that memory-mapped files thing

@scoomby
Copy link

scoomby commented Jan 31, 2022

I'm having the same issue with any check carried out to a large torrent with thousands of files. Be careful with this bug as it will wear your SSD much more quickly if the swapfile is stored on there

@EsEnZeT
Copy link

EsEnZeT commented Feb 1, 2022

I downgraded to 4.3.9, 4.4.0 is eating far too much memory...

@scoomby
Copy link

scoomby commented Feb 1, 2022

I downgraded to 4.3.9, 4.4.0 is eating far too much memory...

I've done the same. It has made a massive difference. The memory consumption is far less with 4.3.9 and I don't want to wear out my boot SSD !!

@weiqi-chen
Copy link

I have the same symptoms.
memory will be ate up when it Checking a BT download.
memory use will drop when it finished a checking.

1
2
4

@Motophan
Copy link

I have a reasonable amount of ram (512gb) and qbt uses 46GB with 219 files. If anyone has issues with qbt using too much ram, i suggest upgrading your computer to reasonable levels of memory. Qbt should also publish specifications of minimum memory, likely 256GB should be enough to run one instance without swapping assuming nothing else is running on the PC. And recommend should be between 384GB to 768GB. I only have a few files so I don't need to go all the way to 768GB as i uninstalled my desktop environment to make more memory available to qbit.

@jsmdy
Copy link

jsmdy commented Feb 21, 2022

DDR5 I presume

@TheFinalCut83
Copy link

And recommend should be between 384GB to 768GB

Very thick, wait, I need to wipe the monitor XD
How could the classics from Blizzard say in such a situation - "don't you, guys, have 512+GB of RAM?"

@Motophan
Copy link

Motophan commented Feb 21, 2022

Screenshot_2022-02-21-10-27-46-201
Try to upgrade your PC if it's struggling @TheFinalCut83 This is probably the minimum required ram to be able to run the pc. At this point qbit is using 20x the memory of the rest of the system (system ~ 2GB, qbit ~ 46GB). If the devs wanted qbit to use less ram they would have done so.

This shows 67GB because my 219 files total about 20GB and it shows the program paging them to memory. But it should free the 20GB (not the 46GB mandatory needed to run the instance). I am running nox to reduce memory requirement so i do not need to upgrade to 786GB of ram

edit: to the thumbs down people, I'm not the qbit devs. they are the ones who made the choice to require so much memory. I'm just making a suggestion to have a minimal ammount of ram in the requirements updated to reflect reality. if this is indeed a unintended issue, which I'm sure it isn't, then they will fix the bug. But i cannot fathom why a application like this could run on less ram than 7 or so full fledged virtual machines could.

@HanabishiRecca
Copy link
Contributor

You are just proving your dumbness further and further.

@c15412
Copy link

c15412 commented Mar 6, 2022

have this problem too

@AlexRozen
Copy link

4.4.1 got 25gb of RAM and started the memory pressure on the 32gb system. During the verification of 330gb torrent.

@Motophan
Copy link

Motophan commented Mar 7, 2022

@AlexRozen min required ram is going to be updated to 512GB.

@jeffward01
Copy link

jeffward01 commented Mar 8, 2022

arvidn/libtorrent#6703 (comment)
arvidn/libtorrent#6667 (comment)

What @arvidn means, if my understanding is correct, that the windows (or any OS) RAM is simply allocated or 'assigned to' QBittorrent, or other software to perform cache functionality.

If another XYZ program, or anything on the OS requires more RAM, then the RAM will be re-assigned FROM QBT to the application or process requesting the RAM.

So it appears as if the RAM is used, and it is allocated, however it is not unavailable. Windows uses words to make it seem as if the RAM is unavailable and not free, because it is assigned as QBT cache, which is true.

Linux has functioned like this for years: https://haydenjames.io/free-vs-available-memory-in-linux/


While this may be true... I am 100% experiencing performance lags in my other applications (chrome and visual studio) due to having QBT open:

image

@mozo78
Copy link

mozo78 commented Mar 9, 2022

Just use Linux, guys. No problems at all :)

@csandazoltan
Copy link

If another XYZ program, or anything on the OS requires more RAM, then the RAM will be re-assigned FROM QBT to the application or process requesting the RAM.

So it appears as if the RAM is used, and it is allocated, however it is not unavailable. Windows uses words to make it seem as if the RAM is unavailable and not free, because it is assigned as QBT cache, which is true.

Linux has functioned like this for years: https://haydenjames.io/free-vs-available-memory-in-linux/

This may be the case, but windows and other programs acts like memory is full, they start to page things otherwise not paged... My page is on regular HDD and things start to stutter, switching programs is slower since windows have to read up the paged memory...

I'm all for using new technologies, but before 4.4.x we had the abilitiy to limit the memory used for file caching, i would like that back

@jeffward01
Copy link

If another XYZ program, or anything on the OS requires more RAM, then the RAM will be re-assigned FROM QBT to the application or process requesting the RAM.
So it appears as if the RAM is used, and it is allocated, however it is not unavailable. Windows uses words to make it seem as if the RAM is unavailable and not free, because it is assigned as QBT cache, which is true.
Linux has functioned like this for years: https://haydenjames.io/free-vs-available-memory-in-linux/

This may be the case, but windows and other programs acts like memory is full, they start to page things otherwise not paged... My page is on regular HDD and things start to stutter, switching programs is slower since windows have to read up the paged memory...

I'm all for using new technologies, but before 4.4.x we had the abilitiy to limit the memory used for file caching, i would like that back

I agree, I think how its 'supposed to work' is:

How its supposed to work

If another XYZ program, or anything on the OS requires more RAM, then the RAM will be re-assigned FROM QBT to the application or process requesting the RAM.

So it appears as if the RAM is used, and it is allocated, however it is not unavailable. Windows uses words to make it seem as if the RAM is unavailable and not free, because it is assigned as QBT cache, which is true.

How it actually works:

But how it actually works is:

  • QBT takes your RAM
  • QBT keeps your RAM
  • Everything on your computer lags more and more due to gradually increased memory consumption
  • QBT lags your computer and crashes due to 95%+ memory consumption

@csandazoltan
Copy link

But how it actually works is:

  • QBT takes your RAM
  • QBT keeps your RAM
  • Everything on your computer lags more and more due to gradually increased memory consumption
  • QBT lags your computer and crashes due to 95%+ memory consumption

I would suggest a minor alteration based on my experience

  • QBT takes your RAM
  • Apps/memory manager sees low free ram
  • Windows start to page "unused" apps to free up ram for qbit
  • Everything on your computer lags more and more due to gradually increased memory consumption and HDD paging
  • QBT lags your computer and crashes due to 95%+ memory consumption

@fschlaef
Copy link

I would suggest a minor alteration based on my experience

  • QBT takes your RAM
  • Apps/memory manager sees low free ram
  • Windows start to page "unused" apps to free up ram for qbit
  • Everything on your computer lags more and more due to gradually increased memory consumption and HDD paging
  • QBT lags your computer and crashes due to 95%+ memory consumption

This, exactly. Having to wait 10 seconds for a mouse click to actually do something while QBT is running is not exactly a great experience.

Rolled back to 4.3.9, no issue at all.

@bearbite
Copy link

Same issue on Win 11 Pro, 21H2. I have 96,9 GB of memory, and qBittorrent ate 99% of it. Memory consumption continuously increases from the OS restart.

@ghost
Copy link

ghost commented Mar 24, 2022

Fixed by #16617 and #16700 on Windows systems. Will be included in next release.

@boomsya
Copy link

boomsya commented Oct 8, 2022

file pool size = 50

but when file pool size = 5000 - I have 1% memory free :(
112

@TheFinalCut83
Copy link

v4.4.5 seems to fix memory leak problem.

@MIC132
Copy link

MIC132 commented Oct 14, 2022

Can't confirm. Still have the same issue on 4.4.5. What's worse, the program becomes unresponsive almost immediately after starting, so if I want to remove a torrent to fix it I have about 1 second.

EDIT: Seems to work ok in 4.5.0beta however

@timdonovanuk
Copy link

Still an issue in v4.5.2

image

@csandazoltan
Copy link

That is your browser running out ram displaying the WEB UI...

Totally different issue

@timdonovanuk
Copy link

My bad. #19034

@glassez glassez reopened this Sep 2, 2023
@glassez glassez closed this as completed Sep 2, 2023
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