LibVNC / x11vnc

a VNC server for real X displays
GNU General Public License v2.0
725 stars 142 forks source link

Hang with 100 % CPU on SIGHUP (closing the terminal) #238

Open rdiez opened 1 year ago

rdiez commented 1 year ago

I am using x11vnc version 0.9.16, which comes with Ubuntu MATE 22.04. I wrote a simple GUI script to make it easy to start a reverse VNC connection:

https://github.com/rdiez/Tools/blob/master/VNC/RemoteControlPrompt.sh

I have been testing it locally by using Remmina's "VNC reverse connection listener" (provided by VNCI, the VNC listener Plugin), and connecting to localhost. As a bonus, when testing this way you get a cool recursive desktop picture. 8-)

Anyway, closing the Remmina remote desktop window, or pressing Ctrl+C on the console where x11vnc runs, works fine, the session tears down as expected.

But if I close the console where x11vnc runs, x11vnc often (not always) hangs and uses 100 % CPU time (on a single core). You cannot stop it anymore with SIGTERM, you have to kill it with SIGKILL.

I haven't done extensive testing, but I am guessing that x11vnc is not reacting well to SIGHUP, or is not coping well when writing to stdout after stdout has been rendered unusable by the disappearing terminal. Because it happens quite often, but not always, it may involve some sort of race condition.

The first step is to get some feedback from you guys: Has anyone seen this problem yet?