https://bugs.winehq.org/show_bug.cgi?id=52322
Bug ID: 52322 Summary: wineserver memory leak during HTTPs download (Genshin Impact Launcher, Qt5) Product: Wine Version: 7.0-rc2 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: mk939@ymail.com Distribution: ---
The Genshin Impact launcher application downloads *.zip archives from an HTTPs server using the Qt5 engine. During the download, the memory footprint of wineserver increases proportionally (approx 1:2) to the amount of downloaded data. This results in systems running out of free RAM due to the 30+ GB download size (!)
This issue is not due to a recent change in Wine. Another user already reported this to me 7 months ago (Wine 6.8-1).
Reproduction report 1: (4 months ago)
* Wine 6.13 (vanilla) * Launcher version: 2.11.2.0 (Qt5 version: 5.12.5.0)
Reproduction report 2: (new)
* Wine 7.0-rc2 (staging), Wine 7.0-rc2 (Lutris) * Launcher version: 2.14.1.0 (Qt5 version: 5.12.5.0)
Launcher download URL for reproduction:
https://genshinimpact.mihoyo.com/client_app/download/launcher/20211221171228...
Due to DNS routing issues I yet cannot reproduce this bug with a recent vanilla Wine version, but will give it a try as soon it is sorted out.
https://bugs.winehq.org/show_bug.cgi?id=52322
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de Component|-unknown |wineserver
--- Comment #1 from Fabian Maurer dark.shadow4@web.de --- Confirming using wine-7.0-rc3. Tried using valgrind, but according to that, nothing got leaked...
https://bugs.winehq.org/show_bug.cgi?id=52322
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW
--- Comment #2 from Fabian Maurer dark.shadow4@web.de --- Forgot to confirm.
https://bugs.winehq.org/show_bug.cgi?id=52322
Bernhard Übelacker bernhardu@mailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |bernhardu@mailbox.org
--- Comment #3 from Bernhard Übelacker bernhardu@mailbox.org --- Created attachment 71583 --> https://bugs.winehq.org/attachment.cgi?id=71583 test-GetVolumeInformationByHandleW.cpp
I tried if I can reproduce this issue and found this while downloading:
- wineserver memory usage increases slightly over time.
- One winedevice.exe memory usage increases a lot more.
- taskmgr, with column handle count shows a increasing number. (For some reason taskmgr stuck at 2,097,152 and increased no more.)
- When launcher.exe is closed the number of handles and memory stayed at high values.
It looks like one thread of launcher.exe is doing a call to GetVolumeInformationW in a tight loop.
Attached test program demonstrates this and shows the same effects.
https://bugs.winehq.org/show_bug.cgi?id=52322
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download CC| |focht@gmx.net URL| |https://web.archive.org/web | |/20220109222357/https://gen | |shinimpact.mihoyo.com/clien | |t_app/download/launcher/202 | |11221171228_70L9WXsk22cU9Lj | |I/mihoyo/GenshinImpact_inst | |all_mihoyo_20211214142226.e | |xe
--- Comment #4 from Anastasius Focht focht@gmx.net --- Hello folks,
I've created a snapshot via Internet Archive here:
https://web.archive.org/web/20220109222357/https://genshinimpact.mihoyo.com/...
https://www.virustotal.com/gui/file/36849a4fbae38d5493d2636f35c14592e73bbd12...
$ sha1sum GenshinImpact_install_mihoyo_20211214142226.exe 524c826742a6fdb1915ab6a26352e38e42fd074f GenshinImpact_install_mihoyo_20211214142226.exe
$ du -sh GenshinImpact_install_mihoyo_20211214142226.exe 119M GenshinImpact_install_mihoyo_20211214142226.exe
Regards
https://bugs.winehq.org/show_bug.cgi?id=52322
--- Comment #5 from Bernhard Übelacker bernhardu@mailbox.org --- Created attachment 71601 --> https://bugs.winehq.org/attachment.cgi?id=71601 ntoskrnl: Free memory before pointer gets set to NULL.
Freeing memory in winedevice.exe: For some reason in dispatch_volume context->in_buff is set to NULL. By that the memory seems to get never freed. This patch attempts to release the memory before the pointer is set to NULL.
But I am not sure if this could be the right place or the right way to do this.
https://bugs.winehq.org/show_bug.cgi?id=52322
--- Comment #6 from Bernhard Übelacker bernhardu@mailbox.org --- Created attachment 71602 --> https://bugs.winehq.org/attachment.cgi?id=71602 server: Close handle of the previous device close request.
Releasing the handle used for the IRP_MJ_CLOSE roundtrip. Otherwise the handle is not used anymore as far as I see, but winedevice.exe gets accounted for it.
But the same here, I am not sure if this is the expected way or place to release that handle.
At least with both patches applied, memory and handle counter stays low while running the first attached test program.
https://bugs.winehq.org/show_bug.cgi?id=52322
Bernhard Übelacker bernhardu@mailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #71602|0 |1 is obsolete| |
--- Comment #7 from Bernhard Übelacker bernhardu@mailbox.org --- Comment on attachment 71602 --> https://bugs.winehq.org/attachment.cgi?id=71602 server: Close handle of the previous device close request.
A similar patch got committed making attachement 71602 obsolete: https://source.winehq.org/git/wine.git/commitdiff/2fc3d7eb2912b189ab38c0683f...
The attachment 71601 still helps to avoid the increased memory usage of winedevice.exe when running the test program in attachement 71583.
https://bugs.winehq.org/show_bug.cgi?id=52322
--- Comment #8 from Bernhard Übelacker bernhardu@mailbox.org --- Submitted attachment 71601 for review: https://source.winehq.org/patches/data/230017
https://bugs.winehq.org/show_bug.cgi?id=52322
ppwwyyxxc@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ppwwyyxxc@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=52322
--- Comment #9 from mk939@ymail.com --- (In reply to Bernhard Übelacker from comment #8)
Submitted attachment 71601 [details] for review: https://source.winehq.org/patches/data/230017
Thank you for the patch. Is there yet any progress in this regard?
https://bugs.winehq.org/show_bug.cgi?id=52322
mashkal2000@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mashkal2000@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=52322
--- Comment #10 from Fabian Maurer dark.shadow4@web.de --- Any news on this? The leak is still present with wine-7.20 and the newest Genshin launcher.
https://bugs.winehq.org/show_bug.cgi?id=52322
--- Comment #11 from Bernhard Übelacker bernhardu@mailbox.org --- Sorry for the delay.
The test application test-GetVolumeInformationByHandleW.cpp still triggers the growing memory usage of winedevice.exe in wine-8.4.
I created this unmodified merge request: https://gitlab.winehq.org/wine/wine/-/merge_requests/2439
https://bugs.winehq.org/show_bug.cgi?id=52322
--- Comment #12 from Bernhard Übelacker bernhardu@mailbox.org --- This bug should now be completely fixed with: https://gitlab.winehq.org/wine/wine/-/commit/07c0cd6ba5f4b1d6ef738ad7f3cad99... (I cannot change this bug's state.)
In the MR is another application "trackmania leaking memory on proton" mentioned - this seems discussed here: https://github.com/ValveSoftware/Proton/issues/6507#issuecomment-1493299894 I found no separate wine bug, but it might be fixed by this commit too.
https://bugs.winehq.org/show_bug.cgi?id=52322
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Component|wineserver |ntoskrnl Status|NEW |RESOLVED Fixed by SHA1| |07c0cd6ba5f4b1d6ef738ad7f3c | |ad9992947dd3d
--- Comment #13 from Zeb Figura z.figura12@gmail.com --- (In reply to Bernhard Übelacker from comment #12)
This bug should now be completely fixed with: https://gitlab.winehq.org/wine/wine/-/commit/ 07c0cd6ba5f4b1d6ef738ad7f3cad9992947dd3d
Marking fixed, thank you!
https://bugs.winehq.org/show_bug.cgi?id=52322
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #14 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 8.7.
https://bugs.winehq.org/show_bug.cgi?id=52322
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |8.0.x
https://bugs.winehq.org/show_bug.cgi?id=52322
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|8.0.x |---
--- Comment #15 from Michael Stefaniuc mstefani@winehq.org --- Removing the 8.0.x milestone from bug fixes included in 8.0.2.