FYI, the Ubuntu bug report is https://bugs.launchpad.net/ubuntu/+source/vnc4/+bug/819473
On Fri, Sep 2, 2011 at 3:29 PM, Tristan Schmelcher <tristan_schmelc...@alumni.uwaterloo.ca> wrote: > Package: vnc4 > Version: 4.1.1+X4.3.0-37 > Severity: normal > Tags: patch > User: ubuntu-de...@lists.ubuntu.com > Usertags: origin-ubuntu oneiric ubuntu-patch > > > I have been experiencing this bug for several years but I finally decided to > investigate it. I run Xvnc through xinetd and I often find that there are > left-over Xvnc processes each consuming 100% CPU. They tend to crop up when a > client disconnects. In particular, scanning ports with nmap produces the > problem every time. > > I've tracked down the problem and implemented a fix. The issue is that Xvnc > in inetd mode detects whether it is run as "wait" or "nowait" by checking if > the inetd socket has a valid peer name with getpeername(). If it has a valid > peer name then it assumes nowait mode, otherwise it assumes wait mode. But > this is unreliable, because if it is run in nowait mode and a client connects > and disconnects very quickly then the socket will no longer have a valid peer > name when Xvnc checks and it will mistakenly use wait mode. The 100% CPU > results from repeatedly trying to call accept() on the socket in the select > loop. > > My solution is to instead detect wait vs. nowait via getsockopt(..., > SOL_SOCKET, SO_ACCEPTCONN, ...), which works reliably in both modes. > > *** /tmp/tmpkCQys0 > I have sent the attached patch to Ubuntu, but I am sending it to Debian too > because there is nothing Ubuntu-specific about it. > > > * Fix 100% CPU hang when run from inetd in nowait mode if a client connects > and disconnects quickly (e.g., nmap). > > > Thanks for considering the patch. > > > -- System Information: > Debian Release: squeeze/sid > APT prefers natty-updates > APT policy: (500, 'natty-updates'), (500, 'natty-security'), (500, 'natty') > Architecture: amd64 (x86_64) > > Kernel: Linux 2.6.38-10-generic (SMP w/8 CPU cores) > Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) > Shell: /bin/sh linked to /bin/dash > -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org