M-Reimer / wine-lol

PKGBUILDs to package GloriousEggroll's LoL-patched wine version
163 stars 20 forks source link

wine-lol leaks into /tmp #79

Closed konomikitten closed 2 years ago

konomikitten commented 3 years ago

Over time wine-lol leaks into /tmp when the Leauge Client Window is left open, this happens very quickly. It also happens on lutris-lol-5.5-2-x86_64 version of wine. It doesn't happen on lutris-6.14-x86_64 but obviously you can't launch games on that version of wine.

Here's tmp at 100% usage

$ df -h | grep -P '^Filesystem|/tmp'
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.0G  1.0G     0 100% /tmp

Here's a small cut of wine-lol leaking into /tmp

$ sudo lsof | grep -P '^COMMAND|/tmp' | grep -P '^COMMAND|wineserve|LeagueCli'
COMMAND       PID     TID TASKCMD               USER   FD      TYPE             DEVICE   SIZE/OFF       NODE NAME
wineserve 1368259                             debian  cwd       DIR               0,37         80    1498586 /tmp/.wine-1000/server-19-b61e26
wineserve 1368259                             debian    6r      DIR               0,37         80    1498586 /tmp/.wine-1000/server-19-b61e26
wineserve 1368259                             debian    7ww     REG               0,37          0    1492957 /tmp/.wine-1000/server-19-b61e26/lock
wineserve 1368259                             debian  525u      REG               0,37      65536   37361327 /tmp/.wine-1000/server-19-b61e26/anonmap.snWgo0 (deleted)
wineserve 1368259                             debian 2048u      REG               0,37     262144   37713266 /tmp/.wine-1000/server-19-b61e26/anonmap.0fVDin (deleted)
wineserve 1368259                             debian 2053u      REG               0,37     262144   37713267 /tmp/.wine-1000/server-19-b61e26/anonmap.9l5pVG (deleted)
wineserve 1368259                             debian 2059u      REG               0,37     262144   37713268 /tmp/.wine-1000/server-19-b61e26/anonmap.CixgB0 (deleted)
wineserve 1368259                             debian 2063u      REG               0,37     262144   37713269 /tmp/.wine-1000/server-19-b61e26/anonmap.BpeKok (deleted)
wineserve 1368259                             debian 2159u      REG               0,37     262144   37361457 /tmp/.wine-1000/server-19-b61e26/anonmap.n2nN3Z (deleted)
wineserve 1368259                             debian 2171u      REG               0,37     262144   37375771 /tmp/.wine-1000/server-19-b61e26/anonmap.0lCNEt (deleted)
wineserve 1368259                             debian 2173u      REG               0,37     262144   37375772 /tmp/.wine-1000/server-19-b61e26/anonmap.fTLCmX (deleted)
wineserve 1368259                             debian 2176u      REG               0,37     262144   37375773 /tmp/.wine-1000/server-19-b61e26/anonmap.IHgscr (deleted)
wineserve 1368259                             debian 2179u      REG               0,37     196608   37375774 /tmp/.wine-1000/server-19-b61e26/anonmap.h7SGVT (deleted)
wineserve 1368259                             debian 2182u      REG               0,37     262144   37375775 /tmp/.wine-1000/server-19-b61e26/anonmap.8J9yLm (deleted)
M-Reimer commented 3 years ago

I did a quick web search and checked the GitHub repo of Wine itself and could not find any information why this happens and also no sign that something around this was fixed in Wine itself.

This can also be some misbehavior of LoL itself. After all you can't properly launch LoL with anything beyond the versions currently used to actually play the game. So whatever causes your /tmp to fill up probably doesn't even properly launch with the Wine versions you tried.

What is required to actually reproduce this? Is it enough to just start the LoL client? Does a game have to be entered and if so: Is it enough to enter "Practice Mode"?

What happens if "/tmp" is actually filled up? Can you still play LoL or does the game crash?

konomikitten commented 3 years ago

What is required to actually reproduce this? Is it enough to just start the LoL client? Does a game have to be entered and if so: Is it enough to enter "Practice Mode"?

It's enough for me just to sit at the latest campaign screen, every time the client shifts data onto the launcher you'll notice /tmp leak a little more data. For reference here is a screenshot:

LeagueClientUx exe Screenshot

I first started posting this on Reddit at LeagueClientUx.exe freezes frequently. There's also another reddit post I found from the past where someone had the same issue /tmp fills up over time (Lutirs wine-lol).

What happens if "/tmp" is actually filled up? Can you still play LoL or does the game crash?

As soon as /tmp fills the client freezes and starts consuming 4 cores of my 12 core system.

Edit: When it freezes I send SIGINT to the process and it restarts just to leak memory again but it does just barely let me play the game.

Here is a readout of the environment settings just to give you an idea of the state of Wine, DXVK v1.9.1 is also being used.

LeagueClientUx.exe.enviro.txt

M-Reimer commented 3 years ago

As far as I know parts of this are rendered with some kind of "Google Chrome browser engine" behind it and this at least was known to cause problems with Wine. It is possible that there were fixes in later Wine versions but it is very, very unlikely I will be able to identify those to backport them to our Wine version. Is there a working workaround? Maybe if you just don't sit on this page? Does /tmp clear out as soon as you join a game if you configure that the client has to be closed once you enter a game?

konomikitten commented 3 years ago

Is there a working workaround?

None that I know of.

Does /tmp clear out as soon as you join a game if you configure that the client has to be closed once you enter a game?

I imagine this will definitely help but the leak is very very bad.

Just to give an idea of how bad the leak is sitting at the screen shown in my previous screenshot the client leaks the entire 1GB of /tmp in 6 minutes.

bash ~
$ ~/Scripts/python/tmp-monitor
2021-08-16 01:48:48.931098 Filesystem     Type   Size  Used Avail Use% Mounted on
2021-08-16 01:48:48.931137 tmpfs          tmpfs  1.0G   12M 1013M   2% /tmp
2021-08-16 01:52:36.577601 tmpfs          tmpfs  1.0G   18M 1007M   2% /tmp <- Client started
2021-08-16 01:52:38.582605 tmpfs          tmpfs  1.0G   19M 1006M   2% /tmp
[SNIP]
2021-08-16 01:58:21.435552 tmpfs          tmpfs  1.0G  990M   35M  97% /tmp
2021-08-16 01:58:22.438540 tmpfs          tmpfs  1.0G  985M   40M  97% /tmp
2021-08-16 01:58:23.441532 tmpfs          tmpfs  1.0G   12M 1013M   2% /tmp <- I exited the client

full-log.txt

konomikitten commented 3 years ago

Just a note switching away from the Home -> Coven to say Home -> Overview slows the leak but interacting with the client in anyway will continue to leak memory. It's a work around of sorts but a poor one.

konomikitten commented 3 years ago

Okay so I found a good work around, the client still leaks but far slower (I've had it running 10 mins on the problematic coven screen and only have 33%/338mb of tmp consumed). Go to Settings Cog -> General -> Enable Low Spec Mode.

bash ~
$ ~/Scripts/python/tmp-monitor
2021-08-16 02:26:01.631764 Filesystem     Type   Size  Used Avail Use% Mounted on
2021-08-16 02:26:01.633127 tmpfs          tmpfs  1.0G   12M 1013M   2% /tmp
2021-08-16 02:28:57.147459 tmpfs          tmpfs  1.0G   18M 1007M   2% /tmp
2021-08-16 02:28:59.151354 tmpfs          tmpfs  1.0G   19M 1006M   2% /tmp
2021-08-16 02:29:00.153674 tmpfs          tmpfs  1.0G   32M  993M   4% /tmp
[SNIP]
2021-08-16 02:40:11.887276 tmpfs          tmpfs  1.0G  367M  658M  36% /tmp
2021-08-16 02:40:14.893507 tmpfs          tmpfs  1.0G  369M  656M  36% /tmp
2021-08-16 02:40:24.919557 tmpfs          tmpfs  1.0G  371M  654M  37% /tmp

full-log.txt

konomikitten commented 3 years ago

As a follow up I decided to test lutris-6.14-x86_64 for a good hour, no leaks:

$ ~/Scripts/python/tmp-monitor
Interval: 0:05:00
2021-08-16 12:14:05.425817 Filesystem     Type   Size  Used Avail Use% Mounted on
2021-08-16 12:14:05.430334 tmpfs          tmpfs  1.0G   12M 1013M   2% /tmp
2021-08-16 12:19:05.532244 tmpfs          tmpfs  1.0G  178M  847M  18% /tmp
2021-08-16 12:34:05.831719 tmpfs          tmpfs  1.0G  205M  820M  20% /tmp
2021-08-16 13:09:06.531892 tmpfs          tmpfs  1.0G  224M  801M  22% /tmp
2021-08-16 13:19:06.731500 tmpfs          tmpfs  1.0G   12M 1013M   2% /tmp

So preferably although I know this is hard and I can't do it myself, the patches that allow the game to launch would be brought up to a later wine version, or whatever stops the client leaking would be brought back down to wine 5.6.

LeagueClientUx.exe.lutris-6.14-x86_64.enviro.txt

M-Reimer commented 3 years ago

So preferably although I know this is hard and I can't do it myself, the patches that allow the game to launch would be brought up to a later wine version, or whatever stops the client leaking would be brought back down to wine 5.6.

None of these will happen. I asked in the relevant Wine bugs for help to get the relevant patches updated and noone replied to this day. And about backporting the change that stops the leak: The most obvious solution would be to use "git bisect". But the big issue is that there is no Wine repository out there which combines wine-staging with Wine commits. Meaning that, at least as far as I know, bisecting wine-staging ends in a nightmare.

Anyway: For me this one is covered here: https://bugs.winehq.org/show_bug.cgi?id=45939

So for me this is an upstream bug where no real "fix" exists. It may have been fixed "by accident" in one of the later Wine versions but I won't go through all the trouble to try bisecting this. Feel free to do so if you like.

For me: End of topic until someone points me to the commit fixing this or a patch appears in some bug.

philipwilk commented 2 years ago

As a follow up I decided to test lutris-6.14-x86_64 for a good hour, no leaks:

$ ~/Scripts/python/tmp-monitor
Interval: 0:05:00
2021-08-16 12:14:05.425817 Filesystem     Type   Size  Used Avail Use% Mounted on
2021-08-16 12:14:05.430334 tmpfs          tmpfs  1.0G   12M 1013M   2% /tmp
2021-08-16 12:19:05.532244 tmpfs          tmpfs  1.0G  178M  847M  18% /tmp
2021-08-16 12:34:05.831719 tmpfs          tmpfs  1.0G  205M  820M  20% /tmp
2021-08-16 13:09:06.531892 tmpfs          tmpfs  1.0G  224M  801M  22% /tmp
2021-08-16 13:19:06.731500 tmpfs          tmpfs  1.0G   12M 1013M   2% /tmp

So preferably although I know this is hard and I can't do it myself, the patches that allow the game to launch would be brought up to a later wine version, or whatever stops the client leaking would be brought back down to wine 5.6.

LeagueClientUx.exe.lutris-6.14-x86_64.enviro.txt

Could you check if this still happens with the current 5.18 version? Cheers.

M-Reimer commented 2 years ago

Mass closing issues. My PKGBUILD builds a much more recent wine version now so some issues may be obsolete now.