mstorsjo/msvc-wine

wineserver -p && cl hangs forever

Closed this issue · 2 comments

With my local installation, and with a self-create docker (I haven't tried the official docker):

When I run wineserver -p && cl it hangs forever without giving output.

The underlying issue seems to be that the stdin of the sed/grep pipeline is never disconnected. Even after the wine64 process is gone, the sed and grep procresses are still there and stay there forever. This is very strange, and I don't really how to debug this further but here are some observations:

  • In fact, there's output. It's just not printed due to a stdout/stderr buffering issue (and because stdin is never disconnected, the buffer is never flushed). I can get some output by changing the sed to sed -u or grep to grep --line-buffered.
  • Another way to get output is to run wineserver -k. Then the pipe is disconnected and the buffers are flushed.
  • Also interesting: wineserver -p3 && cl gives output after ~3 seconds (because then the wineserver dies). 3 seconds is the default when the wineserver is started automatically, and from time to time I had already noticed earlier that calling cl is very slow and essentially takes 3 seconds every time. This is probably the issue (even without invoking an explicit wineserver).
  • When removing the sed/grep pipeline, the problem just disappears entirely.
  • A reliable workaround is to run wineserver -p && wine foo && cl where foo is a (successful) dummy command, e.g. the builtin "hh.exe" is nice because it has no output".

I suspect that somehow the stdin of the pipe is connected to wineserver but I have no idea why this happens. The only thing I could find is this >20 years old thread about a similar issue https://marc.info/?l=wine-devel&m=96644429309991&w=2 But yeah, it's >20 years old...

Yeah, when using a persistent wineserver, I'm running wine64 wineboot as a non-piped command to trigger it to start up, before running the actual compilation commands.

Oh I was about to write that we should document it then but it's actually in the README (# Run wine at least once).