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

Warcraft III: staying in menus quickly gobs all system memory #1866

Closed
sim590 opened this issue Dec 25, 2020 · 85 comments
Closed

Warcraft III: staying in menus quickly gobs all system memory #1866

sim590 opened this issue Dec 25, 2020 · 85 comments

Comments

@sim590
Copy link

sim590 commented Dec 25, 2020

In a matter of at most 20 seconds of staying in the menus, dxvk will reserve all of my 32 GBs or RAM. Starting an game stops the leak though. But as soon as I get back in the menus after a game finishes, the memory leaks accumulate again.

Uninstalling dxvk will remove the memory leak problem and the same attempt at reproducing the issue is not successful. Therefore, dxvk must be leaking.

make sure to test with latest master as well.

I did try and the same happens. The bug is not solved in master.

Software information

The game is Warcraft III Reforged.

System information

  • GPU: Radeon RX 5700XT
  • Driver: amdgpu
  • Wine version: wine-5.22 (Staging)
  • DXVK version: 1.7.3

Log files

Warcraft III_d3d11.log
Warcraft III_dxgi.log
wine.log

@doitsujin
Copy link
Owner

doitsujin commented Dec 25, 2020

apitrace? Also, does the leak show up with DXVK_HUD=memory?

Sounds like a really weird problem since there pretty much hasn't been any game with memory leaks, and Warcraft III is fairly old so I'd somehow expect people to have run into this before...

@sim590
Copy link
Author

sim590 commented Dec 26, 2020

apitrace?

I can't manage to make one. When trying the 64-bit release of apitrace, I'm getting:

error: binaries mismatch: you need to use the 32-bits apitrace binaries to trace this application

and when trying with the 32-bit libraries, the program doesn't load. I'm left with that output that doesn't stop:

wine.log

The thing is that any executable shipped by Blizzard will lead to start Battle.Net and require the user to start the game from the Battle.Net app. The Battle.Net app is 32-bit while the Warcraft III reforged executable is 64-bit. Therefore, I think that I can't start the apitrace in that configuration. Actually, I have two choices for starting Warcraft III:

Warcraft III Launcher.exe: PE32 executable (GUI) Intel 80386, for MS Window

and

_retail_/x86_64/Warcraft III.exe: PE32+ executable (GUI) x86-64, for MS Windows

The first will launch Battle.Net directly. I will get the first message about using 32-bit apitrace if I'm using 64-bit and the program not loading when trying 32-bit. As for the second choice of executable, when trying to run with 64-bit, the program will start Battle.Net, but I don't see any trace written anywhere. Here is what I entered:

$ env TRACE_FILE=apitrace.log DXVK_HUD=memory WINEPREFIX=/var/remise/WineBattleNet wine /home/simon/Téléchargements/apitrace-latest-win64/bin/apitrace.exe trace -a dxgi -v _retail_/x86_64/Warcraft\ III.exe 

There is no file apitrace.log in any subdirectory. If you have any suggestion, I'm ready to follow your instructions.

Also, does the leak show up with DXVK_HUD=memory?

No. It seems like it is the BlizzardBrowser process that takes the most memory according to htop. However, the 3% doesn't match the amount that is taken by the memory bar at the top. Here I stopped at 17GB of memory.

notshown

and Warcraft III is fairly old so I'd somehow expect people to have run into this before...

The game is Warcraft III Reforged. It has been "remastered" recently in the last year.

Addtional logs

I have also found those logs:

BlizzardBrowser_d3d11.log
BlizzardBrowser_dxgi.log

I think that BlizzardBrowser is the program that executes when running the game menu. It's a web based app that launches the game when you start an actual Warcraft game.

@doitsujin
Copy link
Owner

doitsujin commented Dec 26, 2020

Therefore, I think that I can't start the apitrace in that configuration.

You can just copy the correct d3d11.dll, dxgi.dll and dxgitrace.dll from apitrace next to the game's executable (correct architecture of course).

If the problem isn't the game itself but rather the launcher, just setting DLL overrides for the launcher itself (d3d11 and dxgi to builtin) should work around the problem.

@sim590
Copy link
Author

sim590 commented Dec 26, 2020

I managed to make spawn an apitrace.log file. The size is 3.38GB... I assume I can't upload it here. I did upload it here.

@K0bin
Copy link
Collaborator

K0bin commented Dec 26, 2020

Not sure why you renamed it to 'apitrace.log'. Apitrace would've created a file called 'Warcraft.III.trace'.

Anyway, unfortunately the file is broken and ends after just 14 D3D API calls:
grafik

@sim590
Copy link
Author

sim590 commented Dec 26, 2020

@K0bin is it due to the fact that I did kill -9 the process? I would assume so. I will try to make another one but ending the program sooner before I'm forced to kill it.

@sim590
Copy link
Author

sim590 commented Jan 4, 2021

I have regenerated another apitrace. Don't know if it's good though... I don't know why it's no where near 3.38GB as it was the first time...

apitrace.log

NVM. This file was not the right one. I doubted so I changed the file name and reran the program. The new file is 600MB. I'm uploading it right now to mega.nz.

@sim590
Copy link
Author

sim590 commented Jan 4, 2021

The file is here.

@stanczew
Copy link

stanczew commented Feb 4, 2021

You can launch the game directly, skipping Battle.net App, by going to Warcraft III/_retail_/x86_64 and running:

wine "Warcraft III.exe" -launch

This will take you to the login screen inside the game (since login info is not provided by Battle.net App), where the memory leak can already be observed. For me with 16 GB of RAM it's a matter of 5-10 seconds before OOM killer is invoked.

If the problem isn't the game itself but rather the launcher, just setting DLL overrides for the launcher itself (d3d11 and dxgi to builtin) should work around the problem.

It's neither the game nor the launcher, but I can confirm this workaround: setting d3d11 and dxgi to builtin just for BlizzardBrowser.exe makes the issue go away.

Also I gathered an apitrace for BlizzardBrowser. It's with DXVK enabled, since with WineD3D I get an exception when launching the game.

@doitsujin
Copy link
Owner

What was the trace recorded with? I'm just getting error: () unknown call detail 32 when trying to open it.

@stanczew
Copy link

stanczew commented Feb 4, 2021

I followed the instructions in the Wiki, and copied the four dlls into BlizzardBrowser directory (which is one level below the directory of Warcraft III.exe). The only exception is that I didn't disable DXVK, because then 1) the leak is not reproducible, and 2) I couldn't start the actual game.

I then launched Warcraft III.exe as described above. I got BlizzardBrowser.trace files (there are multiple BlizzardBrowser processes spawned when launching the game), and I also got apitrace logs in the Wine output, so I thought it had worked (I've never made an apitrace before).

My system info:

  • GPU: Radeon RX 570
  • Driver: amdgpu
  • Wine version: 6.1 Staging, esync enabled
  • DXVK version: 1.7.3

@doitsujin
Copy link
Owner

can you open your own trace file with qapitrace?

@stanczew
Copy link

stanczew commented Feb 5, 2021

Nope, I get the same error as you.

I'm not sure how/if I can get a useful trace. I see in the new issue template that for D3D11, instead of copying apitrace wrapper dlls, I should run apitrace.exe on the target application. But, I'm not manually launching BlizzardBrowser.exe; and if I run apitrace on Warcraft III.exe I get a bunch of apitrace: warning: caught exception 0xc000001d logs in the console, and the resulting trace is just 2.5 KiB / 5 calls.

Then, according to this comment, it should nevertheless be possible to use the "copy dlls" method; but no matter how I try to do this, I still get unknown call detail <number> when viewing the trace.

@sim590
Copy link
Author

sim590 commented Feb 7, 2021

@stanczew :

It's neither the game nor the launcher, but I can confirm this workaround: setting d3d11 and dxgi to builtin just for BlizzardBrowser.exe makes the issue go away.

Can you explicit how you go about overriding the DLL just for BlizzardBrowser.exe and not for the game? The game actually needs native DLLs for dxvk to make its magic and make the game playable. Otherwise, the game graphics are really messed up with low gamma.

EDIT:

I tried doing the following:

ln -s /usr/lib32/wine/d3d11.dll $BLIZZARDBROWSERDIR/d3d11.dll
ln -s /usr/lib32/wine/fakedlls/dxgi.dll $BLIZZARDBROWSERDIR/dxgi.dll

but it didn't go around the issue. Memory was still leaking like before.

@stanczew
Copy link

stanczew commented Feb 7, 2021

Can you explicit how you go about overriding the DLL just for BlizzardBrowser.exe and not for the game?

Run winecfg, on the "Applications" tab click "Add application…" and choose BlizzardBrowser.exe, click on it so it's focused, then go to "Libraries" tab and add d3d11 and dxgi as builtin:
image
image

@cg666
Copy link

cg666 commented Feb 7, 2021

I have the same issue. I enabled DXVK_HUD=memory and I don't see the game eating memory from HUD infos nor with "top" command.

But, the GPU memory get filled very quickly. I set up the OoM Killer and it is not triggered. I suspect memory allocated on GPU and never released. That's why the OoM Killer does nothing.

I have NVIDIA GTX 960. It seems not related to GPU driver as other reports issue on AMD.

Hope it can help.

@Maia-Everett
Copy link

Thanks, stanczew, the workaround seems to have worked for me. BlizzardBrowser still leaks memory a bit, but at such a slow pace that it's going to be unnoticeable in practice, since you aren't going to stay in the main menu for that long.

@SeanMcnabb
Copy link

SeanMcnabb commented Apr 19, 2021

This workaround is working for me as well.

@HolimaX
Copy link

HolimaX commented May 8, 2021

Workaround gives just a little extra time to start Campaign. It makes game navigable, but not really enjoyable.. just yet.

@nerzhul
Copy link

nerzhul commented May 13, 2021

hello,
i have the issue starting when i enter in a custom map multiplayer party, the memory fills in 10sec and bye :(
if i kill the blizzardbrowser.exe it stops the leak, but don't reclaim the memory and the game UI freeze
the workaround seems to work for now

@ghost
Copy link

ghost commented May 30, 2021

I also get huge memory allocations when running the game and it runs nice for like 10 seconds and then just freezes the game.
Overriding the BlizzardBrowser.exe didn't do much.

I made a mistake while overriding the DLLs didn't set the correct ones. And it does fix the leak the game doesn't freeze but i can't actually see anything for the game just renders a black screen and the ingame mouse cursor.

EDIT: Managed to fix it by not overriding the dxgi dll, just the d3d11 and d3d9.

@RadicalGDPRist
Copy link

RadicalGDPRist commented Dec 21, 2021

Same issue, the workaround from above works. I could not get a useful trace on Windows 7 x64 either. Most of the 67MB trace are calls to "ID3D11Device1::CheckMultisampleQualityLevels" and then basically The End.

I'm ready to provide the game files, I don't think it needs an account/installation for repro as you can access the main menu; or my account if the dev is willing to test.

Detailed information:

Warcraft 3 Reforged uses CEF/Chromium v69 for all the new menu parts. This includes: main menu, map loading screen, settings screen. The old game renderer was left untouched, I think it looks like this:

                    ↙ Legacy game engine renderer (dx9/dx11/opengl)
Presentation/Compositor, reported as dx11
                    ↖ CEF menu renderer (apparently dx11?)

Note: the only place, where both renderers are "visible" and overlayed, is when you go to Menu>Options while in-game.

Game's launch options -graphicsapi opengl/direct3d11/direct3d9[1] did not change Warcraft 3.exe's reported used API, but dx9 has 3x performance improvement with in-game renderer for me on Windows, so that part works. The in-game renderer works flawlessly under Wine. It should be using dx11 by default

The CEF renderer leaks ~1GiB of memory every time you hover over all 6 main menu buttons (see on the left behind htop window). Basically it leaks memory any time a menu element is re-rendered. You can get quite far with 32GB RAM and 8GB swap, but you'll freeze/OOM eventually. htop does not show an increase in res/virt memory for the BlizzardBrowser.exe process. This excessive garbage creation explains the low menu FPS too (buffer not reused?).

For my tests the main menu background animation removed and not rendered (see "Allow Local Files", the video was replaced with an empty Warcraft III/_retail_/webui/webms/mainmenu.webm). There was no increase in used memory when I did not move the cursor.

PS: Trying to execute apitrace the way it's meant to be prints: "error: failed to execute inject". Putting all three .dll's (d3d11.dll, dxgi.dll, dxgitrace.dll) prints: "error: unavailable function CreateDXGIFactory2" and exits the game process (this method was suggested above). Removing dxgi.dll floods a lot of "apitrace: warning: caught exception 0xc000001d", "0xc0000420", "0x80000003" etc. but produces no useful trace (only CheckMultisampleQualityLevels). I'm not sure how to do it right.

[1]: See "Warcraft III/Patch 1.31.0" changelog

@epatpol
Copy link

epatpol commented Feb 15, 2022

I've tried the above workarounds (overriding d3d11 and dxgi in wine configuration) and I still have horrible memory leaks where even with 32gb ram I'll crash before entering a custom or a normal game. Anybody made some progress with this?

@nerzhul
Copy link

nerzhul commented Mar 8, 2022

@epatpol tried 1 week ago, same issue yes

@Arnoldi
Copy link

Arnoldi commented Mar 12, 2022

I have the same problem. I had the game running for more than a year, but recently deleted and reinstalled the game (nothing else in my system). I lost the config I had, but now I can't get it to not leak memory anymore.

@epatpol
Copy link

epatpol commented Mar 12, 2022

@Arnoldi Yea same for me, I tried setting older versions of wine or dxvk in lutris but it's always the same, as soon as I arrive in the menu my memory consumption ramps up so quickly I have to find a game within a minute or so. It's basically unplayable for me right now. I have no idea what the culprit is however, does it leak in Windows as well but maybe at a slower rate? I've seen wc3 streamers having to restart their wc3 every couple of hours because they say it ends up crashing if you let it running...

@ChristophHaag
Copy link

ChristophHaag commented Mar 24, 2022

I've had this too. A few observations:

  • It usually starts happening when upgrading wine (I use lutris and the lutris builds)
  • It randomly stops happening after starting warcraft with old versions of mesa, but not always. pattern very unclear. mesa shader cache doesn't seem to be related either.

It's definitively BlizzardBrowser eating VRAM, I would assume it's a bug in the texture sharing between libcef and warcraft too. The rate at which the VRAM fills is directly related to the resolution of the warcraft window. You can watch the VRAM being eaten live e.g. with radeontop. Once the VRAM is full, it starts eating GTT, which is system ram that is provided to applications instead of physical VRAM.

On AMD you can cat /sys/kernel/debug/dri/0/amdgpu_gem_info as root to see who allocates how much VRAM. At 4k BlizzardBrowser makes lots of 134 mb allocations

pid  2104851 command BlizzardBrowser:
[...]
	0x00000070:    134217728 byte VRAM NO_CPU_ACCESS EXPLICIT_SYNC
	0x00000071:    134217728 byte VRAM NO_CPU_ACCESS EXPLICIT_SYNC
	0x00000072:    134217728 byte VRAM NO_CPU_ACCESS EXPLICIT_SYNC
	0x00000073:    134217728 byte VRAM NO_CPU_ACCESS EXPLICIT_SYNC
	0x00000074:    134217728 byte VRAM NO_CPU_ACCESS EXPLICIT_SYNC
[...]

I don't know if it's a useful data point but setting d3d9/d3d11 to native didn't have any effect here. With wine lutris 7.2 I didn't get it to stop eating VR with many tries but with wine lutris 6.14 I did eventually.

@krablord
Copy link

krablord commented Apr 24, 2022

Played without any issues pretty much on release. Right now it memory leaks all the way to game freeze (vram and ram), none of the workarounds helped.
Also DXVK could not see that happening, there is 1 BlizzardBrowser.exe (there are 3 or 4 in total) process with lowest "Disk read total" that u can kill after entering the game and it will free all memory until u go to menu again.

Ubuntu 20.04 + Nvidia 470
Edit: for bad workaround

@xadips
Copy link

xadips commented Apr 24, 2022

Indeed a few months ago I could still play normally, right now I'm almost always getting memory leaks on menu and it fills up my 32 GB ram so quickly, none of the workarounds worked, tried different wine versions/settings, sometimes it does not leak on wined3d.

Arch + Nvidia 510.60.02

@Blisto91
Copy link
Contributor

Blisto91 commented Aug 23, 2022

Glad you got it working.

If any of you find any new problems where you think dxvk is the cause then i encourage you to make a new issue. 🙂

@orklann
Copy link

orklann commented Aug 26, 2022

@Blisto91 I download Wine-GE-Proton7-26 with lutris, and it still shows me a black screen.

@orklann
Copy link

orklann commented Aug 26, 2022

Do I need to set to Win 7 compat mode? I tried to set to Win7 compat mode, but battle net client can not opened.

@Blisto91
Copy link
Contributor

I don't own the game so i can't check for myself atm.

Post dxvk logs if you can. When using Lutris you need to set "Output debugging info" to enabled under runner options.
Then some dxvk logs should appear next to the games exe. d3d9, dxgi, d3d11 etc when you run the game.

@orklann
Copy link

orklann commented Aug 26, 2022

Okay, I need to do everything from scratch, will upload the log later.

@orklann
Copy link

orklann commented Aug 27, 2022

@Blisto91 It seems there is no log appear next to my .exe file.

@Blisto91
Copy link
Contributor

Even after enabling Output debugging info for the games runner?

@orklann
Copy link

orklann commented Aug 27, 2022

Yes, I have enabled Output debugging info in the games runner at the bottom of the window.

@Blisto91
Copy link
Contributor

In the lutris environment variables can you add DXVK_HUD and then set it to 1 and then verify the hud shows in the top left corner ingame

@orklann
Copy link

orklann commented Aug 27, 2022

Thank you for your tips, I will try it later. Now i am building wine-tkg from what @kolAflash suggested, and install dxvk 1.10.3 by winetricks.

@Blisto91
Copy link
Contributor

Blisto91 commented Aug 27, 2022

Roger. This should hopefully start working better out of the box when when more custom wine versions start including the work required. E.g lutris and bottles own wine.

A separate thing to try would be to add it as a non steam game in steam and then force it through proton experimental.

@orklann
Copy link

orklann commented Aug 27, 2022

@Biswa96 I tried that yesterday, with proton experimental it still the same issue.

@Blisto91
Copy link
Contributor

Blisto91 commented Aug 27, 2022

Do you still have that setup? Launching that with PROTON_LOG=1 %command% and then posting the proton log that appears in your users home folder could also provide some interesting info.

@orklann
Copy link

orklann commented Aug 27, 2022

@Blisto91 Do you mean the non-steam games with proton experimental setup?

@Blisto91
Copy link
Contributor

Ye

@orklann
Copy link

orklann commented Aug 27, 2022

No, I have removed it.

@Blisto91
Copy link
Contributor

k.

I kinda forgot to ask. What is your gpu and drivers.

@orklann
Copy link

orklann commented Aug 27, 2022

Mesa Intel® Iris(R) Plus Graphics 640 (Kaby Lake GT3e) (KBL GT3)

Ubuntu 22.04 with default GPU driver.

@Blisto91
Copy link
Contributor

Okay that could maybe be part of the cause. I don't have any experience myself with intel iGPU's but i think don't they have as well of a track record as amd and nvidia with dxvk. At least not the older ones.
I would very much advice making sure you have the latest stable drivers you can. Preferably at least mesa 22.0

@orklann
Copy link

orklann commented Aug 27, 2022

I just setup non-steam proton game, and here is the log by setting PROTON_LOG=1 %command% as the lunch options.

steam-11195755666436259840.log

@orklann
Copy link

orklann commented Aug 27, 2022

I also set the DXVK_HUD to 1, and got the HUD showed up.

Screenshot from 2022-08-27 10-20-40

@orklann
Copy link

orklann commented Aug 27, 2022

I think i was downloading the wrong Wine-GE-Proton7-26, i download the from the official github repo, and i can run Warcraft III reforged, but I get into the lions's gate screen, then shows nothing with a mouse cursor.

Screenshot from 2022-08-27 14-00-41

Any help?

@Blisto91
Copy link
Contributor

Blisto91 commented Aug 27, 2022

Again there is no need to post many times in a row. Just edit your first post.

Anyway no i don't see anything interesting in your log in relation to dxvk. You could try turning off esync in lutris ui or steam (PROTON_NO_ESYNC=1 %command% for the latter) since there are some esync related errors, but i'm not that convinced it will help.
This could just be some intel weirdness with your gpu or driver (version is fine). Tho i dont actually know

@orklann
Copy link

orklann commented Aug 27, 2022

@Blisto91 I finally make it work to run Warcaft III Reforged on Lutris with Wine-GE-Proton7-26 in the link you mentioned above, I just need to wait for the first time the intro video to pass, and after that it crashed, then I just set the window version for BlizzardBrowser.exe to windows 7, and also override these two DLLs (d3d11 and dxgi as builtin) for BlizzardBrowser.exe as mentioned in previous post in this thread. All works fine after restart Battle.net and restart the game.

Thank you @Blisto91 for your help. :)

@Blisto91
Copy link
Contributor

Blisto91 commented Aug 27, 2022

Good to hear you managed to get it working 👍 and that it wasn't just your GPU that wouldn't work with it.
Since i don't own it myself i wasn't able to be more specific in my assistance 🙂

@orklann
Copy link

orklann commented Aug 27, 2022

@Blisto91 I checked the Wine-GE github repo, they have a GPU list which they support, and my Intel GPU is in the list, so I just try some different settings, and it works fine. It's not my GPU issue.

@Blisto91
Copy link
Contributor

Blisto91 commented Aug 27, 2022

Good to hear. I know almost nothing about intel GPUs hehe
Alot of Linux gaming can still be a bit janky out of the box. Hopefully it continue to improve so more things just work without tweaking

@orklann
Copy link

orklann commented Aug 27, 2022

https://github.com/lutris/docs/blob/master/InstallingDrivers.md

Yeah, In this page, it mentioned that Only Skylake and newer Intel CPUs (processors) offer full Vulkan support, and my Intel GPU is Kabylake. :)

I prefer to switch to classic graphic in Warcraft III Reforeged, I can get full stable 60fps, but i would not like to try Reforged graphic, which is too hard for my GPU to get good performance, and I also prefer classic graphics, so that's good for me.

@SeanMcnabb
Copy link

I'm not sure if this is a dxvk issue or wlroots/wayland issue but anytime I try to run wc3 in a wlroots window manager, I keep getting the following error over and over again and it just hangs at the loading screen. This happens when I set the blizzardbrowser.exe library overrides to wine instead of native

06e8:err:winediag:wined3d_dll_init Using the Vulkan renderer.
06e8:fixme:d3d:adapter_vk_init_driver_info Failed to retrieve GPU description for device "AMD Radeon RX 6700 XT (RADV NAVI22)" 1002:73df.
06e8:fixme:kernelbase:AppPolicyGetProcessTerminationMethod FFFFFFFFFFFFFFFA, 000000000011FD70

If I keep the overrides set to native, it will result in the following over and over again.
07c8:fixme:kernelbase:AppPolicyGetProcessTerminationMethod FFFFFFFFFFFFFFFA, 000000000011FD70

Everything is working properly though in x window managers, but I would like to get this working in wayland if possible. Anyone have any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests