ETEST, EINTR, and interrupted read() system call

Jason Craig jason.roscoe at gmail.com
Thu Apr 10 03:45:26 PDT 2014


Hi,

I posted this on one of the other mailing lists but haven't seen any 
response so maybe this is a better list for it.

I am troubleshooting a problem with a Java X client getting disconnected 
from the X-server (explicit kill or server shutdown message).  I've 
tracked it down in the X-server to the StandardReadRequestFromClient() 
routine in os/io.c and the call to _XSERVTransRead() (which ultimately 
calls read()).  This routine normally works fine but very occasionally 
it returns -1 with errno set to EINTR.  This causes the server to close 
down the connection.

I normally would expect this condition to call for a retry on the read() 
since it was interrupted.  But, the code does not pay any attention to 
EINTR.  There is a macro, ETEST() which only takes into account EAGAIN 
and EWOULDBLOCK.  For all other cases, if -1 is returned from the 
read(), it is considered a fatal error and the X-server proceeds to 
close down the connection.  So, my main question has to do with whether 
or not EINTR is supposed to be taken into account in another fashion?

The Xorg server I am using is very old, xorg-6.8.2 from RHEL4.  But, 
I've looked at current sources and they are essentially the same. So, 
can someone shed any light on why this may be happening?  What signal 
might be interrupting the read()?  Why is EINTR not retried? How can I 
get around this issue?

Thanks for your help.
Regards,
Jason


More information about the xorg-devel mailing list