Hello,

 I've had intermittent problems with the "mwm" window manager, when I issue
 a ctrl-d sequence on the failsafe client. (I use xdm to get the server
 started and xterm as the failsafe client) The mwm process does not get
 killed and loops indefinitely.  After some amount of debugging I've
 narrowed the problem down to the "_XEventsQueued ()" routine in
 XlibInt.c.  Here the routine issues an FIONREAD ioctl to determine the
 number of bytes left to be read.  It also seems to rely on the ioctl to
 detect a broken connection. In my case, the server has closed down the
 slave side of the connection but the ioctl does not detect it. It returns
 0 bytes left to be read. In short the scenario is something like this, 

 .....  
 poll () returns 1 with POLLIN (the zero byte message sent by the slave pts module) 
 ioctl (fd, FIONREAD, &pend)  returns 0 with pend = 0 
 ... ad inifinitum...  

 Now, it seems there is some code within _XEventsQueued () to detect this scenario
 compiled with the XCONN_CHECK_FREQ compile option (this is set to 256 in
 my case). The following code snippet from _XEventsQueued () in XlibInt.c should
 clarify this.
 
 _XEventsQueued ()
 {
 .  . .
        ioctl (fd, FIONREAD, &pend);
 #ifdef XCONN_CHECK_FREQ
         /* This is a crock, required because FIONREAD or equivalent is
          * not guaranteed to detect a broken connection.
          */
 
         if (!pend && !dpy->qlen && ++dpy->conn_checker >= XCONN_CHECK_FREQ) {
                      ^^^^^^^^^
                // issue a read which will detect the zero length message and
                // exit from the app.
        }
 .....
 #endif
 }
 In my case the dpy->qlen is non-zero so the block of code never gets
 executed.  My question is, can this condition be removed ? What was the 
 reasoning behind adding this check ? 

 thanks,
 santosh.
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to