[PATCH] poll() hang with X apps

Doug White dwhite at gumbysoft.com
Sat Sep 4 22:38:41 PDT 2004

Attaching to an earlier message here...

rwatson and I may have a solution to the poll() hangs you have been
experiencing. Try downloading and applying this patch:


This seems to stop the hangs on my test system (2x600MHz P3 with XFree
4.3). I'll test it with its partner, a RELENG_5 box with either Xorg or
XFree86 4.4.  Please test it and get back to us if its working for you.

For those of you tuning in late:

Maxim has been having problems with WindowMaker dockapps not starting up
all the way, with the app hanging in a poll() call in the X library while
trying to draw itself. I am able to reproduce the problem by starting up a
xscreensaver hack (rubik is my favorite right now) and running a -j3
buildworld in the background.  Within a couple of minutes rubik would stop
moving; focussing the window would wake it back up again.  ps axl would
show it in 'select' and gdb found it in a poll() call in a XPixmap

This patch changes the socket locking to lock both send and receive
buffers while poll() is scanning the file descriptor for available data.
We think that the prior locking was allowing one process to write data
into the socket buffers after it had been scanned and the decision made
that there was no data on the socket.  Thus the process would be put to
sleep with available data.  Another write to the socket (focussing the app
in the test case) would cause it to be woken up.

Again, please test and let me or rwatson know if you have feedback.

Doug White                    |  FreeBSD: The Power to Serve
dwhite at gumbysoft.com          |  www.FreeBSD.org

More information about the freebsd-current mailing list