[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#246643: _XPollfdCacheDel: select(s) forever when used with fglrx.



retitle 246643 libx11-6: _XPollfdCacheDel() select()s forever when called by fglrx_dri.so
tag 246643 + moreinfo upstream help
thanks

On Fri, Apr 30, 2004 at 01:48:16AM -0500, Mike Mestnik wrote:
> Package: libx11-6
> Version: 4.3.0-7
> Severity: normal
> 
> (gdb) bt
> #0  0x403e3398 in select () from /lib/tls/libc.so.6
> #1  0x4018de32 in _XPollfdCacheDel () from /usr/X11R6/lib/libX11.so.6
> #2  0x4018eda1 in _XRead () from /usr/X11R6/lib/libX11.so.6
> #3  0x4093c2d9 in s5943 () from /usr/X11R6/lib/modules/dri/fglrx_dri.so
> #4  0x40950593 in s3197 () from /usr/X11R6/lib/modules/dri/fglrx_dri.so
> #5  0x4094d984 in s3176 () from /usr/X11R6/lib/modules/dri/fglrx_dri.so
> #6  0x4094ccff in s5118 () from /usr/X11R6/lib/modules/dri/fglrx_dri.so
> #7  0x4094d02a in __driCreateScreen () from
> /usr/X11R6/lib/modules/dri/fglrx_dri.so
> #8  0x40123fda in AllocAndFetchScreenConfigs () from /usr/X11R6/lib/libGL.so.1
> 
> I also got this bt with DRI installed, but they do not replace libX11.so.
> (gdb) bt
> #0  0x4027d398 in select () from /lib/tls/libc.so.6
> #1  0x40103e32 in _XPollfdCacheDel () from /usr/X11R6/lib/libX11.so.6
> #2  0x40104da1 in _XRead () from /usr/X11R6/lib/libX11.so.6
> #3  0x407dc2d9 in s5943 () from /usr/X11R6/lib/modules/dri/fglrx_dri.so
> #4  0x407f0593 in s3197 () from /usr/X11R6/lib/modules/dri/fglrx_dri.so
> #5  0x407ed984 in s3176 () from /usr/X11R6/lib/modules/dri/fglrx_dri.so
> #6  0x407eccff in s5118 () from /usr/X11R6/lib/modules/dri/fglrx_dri.so
> #7  0x407ed02a in __driCreateScreen () from /usr/X11R6/lib/libGL.so.1

Well, here are the sources to _XRead() and _XPollfdCacheDel().  Both
live in xc/lib/X11/XlibInt.c.

/* 
 * _XRead - Read bytes from the socket taking into account incomplete
 * reads.  This routine may have to be reworked if int < long.
 */
int _XRead (dpy, data, size)
	register Display *dpy;
	register char *data;
	register long size;
{
	register long bytes_read;
#ifdef XTHREADS
	int original_size = size;
#endif

	if ((dpy->flags & XlibDisplayIOError) || size == 0)
	    return 0;
	ESET(0);
	while ((bytes_read = _X11TransRead(dpy->trans_conn, data, (int)size))
		!= size) {

	    	if (bytes_read > 0) {
		    size -= bytes_read;
		    data += bytes_read;
		    }
		else if (ETEST()) {
		    if (_XWaitForReadable(dpy) == -2)
			return -2; /* internal connection did XPutBackEvent */
		    ESET(0);
		}
#ifdef SUNSYSV
		else if (ECHECK(0)) {
		    if (_XWaitForReadable(dpy) == -2)
			return -2; /* internal connection did XPutBackEvent */
		}
#endif
		else if (bytes_read == 0) {
		    /* Read failed because of end of file! */
		    ESET(EPIPE);
		    _XIOError(dpy);
		    }

		else  /* bytes_read is less than 0; presumably -1 */ {
		    /* If it's a system call interrupt, it's not an error. */
		    if (!ECHECK(EINTR))
		    	_XIOError(dpy);
		    }
	    	 }
#ifdef XTHREADS
       if (dpy->lock && dpy->lock->reply_bytes_left > 0)
       {
           dpy->lock->reply_bytes_left -= original_size;
           if (dpy->lock->reply_bytes_left == 0) {
	       dpy->flags &= ~XlibDisplayReply;
               UnlockNextReplyReader(dpy);
	   }
       }
#endif /* XTHREADS*/
	return 0;
}

/* ARGSUSED */
void _XPollfdCacheDel(dpy, fd)
    Display *dpy;
    int fd;			/* not used */
{
#ifdef USE_POLL
    struct pollfd *pfp = (struct pollfd *)dpy->filedes;
    struct _XConnectionInfo *conni;

    /* just recalculate whole list */
    if (dpy->im_fd_length <= POLLFD_CACHE_SIZE) {
	int loc = 1;
	for (conni = dpy->im_fd_info; conni; conni=conni->next) {
	    pfp[loc].fd = conni->fd;
	    pfp[loc].events = POLLIN;
	    loc++;
	}
    }
#endif
}

Would someone like to eyeball the above?

-- 
G. Branden Robinson                |    Humor is a rubber sword - it allows
Debian GNU/Linux                   |    you to make a point without drawing
branden@debian.org                 |    blood.
http://people.debian.org/~branden/ |    -- Mary Hirsch

Attachment: signature.asc
Description: Digital signature


Reply to: