rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.89k stars 276 forks source link

High memory usage on windows 11 when building, seems to be memory leak. #4715

Open samuk190 opened 1 year ago

samuk190 commented 1 year ago

Actual Behavior

high memory usage which scalates quickily even on lightweight containers.

Steps to Reproduce

run any container through docker-compose (docker cli)

Result

Freezing PC

Expected Behavior

Not have this memory leak.

Additional Information

this bug is also present on official docker desktop. (2 major issues open not solved for years)

Rancher Desktop Version

latest

Rancher Desktop K8s Version

Latest

Which container engine are you using?

moby (docker cli)

What operating system are you using?

Windows

Operating System / Build Version

Windows 11 22h2

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No

rak-phillip commented 1 year ago

Hi @samuk190, thanks for raising this issue and helping to make Rancher Desktop better!

Do you have more information available to help the team investigate? If you can, please provide a minimal reproduction example as well as information about the hardware you are running Rancher Desktop on (available memory, CPU, etc.). This will help us out a great deal in understanding and resolving the issue.

samuk190 commented 1 year ago

@rak-phillip Computer specs: Ryzen 9 5950x 32 gb ram Rtx 3090

Wndows 11 latest version. latest verison wsl2

I dont have this issue running docker desktop with hyper v mode.(but i dont want to run hyper v because it reserve resources instead of using "on-demand")

This issue only happens on docker desktop wsl, and rancher desktop wsl ( i think because you guys use same engine)

Example:

rancher run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=yourStrong(!)Password" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest

Wait 30 mins...

expect high ram usage. CPU seems normal, only ram is the problem at point of after some hours it uses 99% of the computer ram. ps: repro this without any .wslconfig inside your %appdata%, so you have unlimited ram in your wsl to see the bug happening.

You can repro this bug on latest version of official docker desktop too :( if you guys fix this it would be awesome because this bug is very oooooooold on windows... last time I abandoned docker-desktop was because this bug (3 years ago) and sadly is stil present, thats why I tried rancher-desktop to see if it would be different

dpmerrill commented 1 year ago

I have not been able to reproduce this issue, but it is a known problem with Docker and/or WSL depending on which problem is being seen.

Some people have seen WSL reserve a lot of resources, but that can be limited with configuration. This link explains that: https://www.koskila.net/how-to-solve-vmmem-consuming-ungodly-amounts-of-ram-when-running-docker-on-wsl/

As far as the docker issue, some people have joked that we'll have to wait for Windows12.

Either way, there doesn't seem to be anything we can do from the Rancher Desktop side of things.

jstafford5380 commented 11 months ago

I have this same issue on docker builds intermittently. Just today I ran the same build twice (different times) without changing anything about the dockerfile or the build command. The build usually takes about 5m, the second one didn't even get 50% through the dockerfile after 30m and was using 23GB of memory and 60% cpu. I finally killed it and shut rancher down to regain the memory. Ran it a 3rd time and it was fine.

image