protonscr

cmd.exe command causes wine background processes to hang

wineclosed
ValveSoftware/wine#126 · opened 2021-09-26 by Matoking · updated 2021-10-28 · 3 comments · github
MMatoking 2021-09-26 github

Running wine cmd.exe /c echo '%ProgramFiles%' causes the original process to exit successfully, but wineserver and other background processes continue in the background without cleaning themselves up. If the command is executed using Steam Runtime Soldier, this means the entire command will hang indefinitely due to the remaining processes. If not, the background processes will continue in the background after the command has finished.

The issue can be reproduced this way:

  • Launch a Steam game using Proton Experimental with the PROTON_DUMP_DEBUG_COMMANDS=1 set.
  • Go to the debug directory and edit run to remove steam.exe from the last line. If this is not removed, Wine will clean up after itself properly.
  • Run ./run cmd.exe /c echo '%ProgramFiles%'. The path will be printed and cmd.exe will exit, but other processes will continue execution in the background.

This issue occurs on Proton Experimental 1632501009 experimental-6.3-20210924, but not Proton 6.3. Other commands such as winecfg.exe work properly without causing the background processes to hang.

I've uploaded a Wine log with WINEDEBUG="+timestamp,+pid,+tid,+seh,+debugstr,+loaddll,+mscoree" here:

https://gist.github.com/Matoking/e59586e9d9f929ec7506663d4b907039

Tested on Arch Linux with kernel version 5.14.6-arch1-1.

Iivyl 2021-09-27 github

Moi @Matoking,

I had a hunch that this may be related to 50cf7ea9e236 ("wineboot: HACK: Run tabtip.exe on startup.") and indeed it is. Looks like there's something about short-lived processes, like the cmd invocation, that tabtip.exe does not like and doesn't exit. If I run the exact same command again (while wineserver et al. are still running) the prefix is shut down properly.

FWIW the easiest way to reproduce this is to compile a standalone wine:

tools/make_requestes
./configure --enable-win64 --disable-tests
make -j $(nproc)
./wine cmd.exe /c echo '%ProgramFiles%'

With newer gcc versions (like the one in Arch) I had to cherry-pick f01312764749 ("msvcrt: Add sincos to importlib.")

We'll look into fixing that. Thanks for reporting this issue :-)

Iivyl 2021-09-27 github

We have a fix that will be included in the next experimental release.

MMatoking 2021-10-28 github

Moro, I can confirm that the issue is fixed as of experimental-6.3-20211027, though it was probably fixed earlier; there was a different unrelated issue in the release prior to that, but that was fixed as well.