TigerVNC client to built-in VNC server causes VM to crash/freeze
Host environment
- Ubuntu Linux 20.04
- Kernel 5.4.0-91 x86_64
- qemu-system-x86_64
- QEMU built from Git
- QEMU emulator version 6.2.50 (v6.2.0-642-gd7007537)
I actually noticed this problem a long time ago so I'm not sure when it was introduced (maybe QEMU 5 or 6? I'm just guessing). Many older builds have the same problem.
Emulated/Virtualized environment
Any guest or no guest at all. Text-mode/console-only or graphics does not matter.
Description of problem
Connecting to the built-in VNC server via TigerVNC upon disconnect the whole VM process freezes/crashes. The process continues to exist but does not respond to any network connection and the monitor socket is dead too. Killing it with TERM doesn't work.
Using tigervnc-viewer 1.10.1+dfsg-3 (Ubuntu 20.04) with default options like vncviwer localhost:0
Steps to reproduce
qemu-system-x86_64 -vnc 127.0.0.1:0
- Connect to built-in VNC server via TigerVNC
- Keep the VNC connection open and wait some period of time (usually 5-10 minutes is enough though sometimes hours) then disconnect/reconnect VNC. If the reconnect succeeds then wait again for a period of time then disconnect and try again until failure. Often just connecting and disconnecting to the VNC once is enough to make the VM eventually crash/freeze even if running only in the background but this is less reproducible.
- Observe VM is no longer responsive to anything
If TigerVNC is never connected/disconnected from the VM then this doesn't happen.
Additional information
Note due to the nature of this issue it might be hard to reproduce for unknown reasons. The VM always eventually freezes though. The qemu process has no output when it freezes.
As far as I can tell connecting to the built-in VNC server via gvncviwer
seems to be OK and doesn't cause an issue (?). I'm not sure about other VNC clients (eg. TurboVNC).
I am connecting to the VNC server from a completely different machine than the host via SSH port redirection (the host is headless). Not sure if that matters.