[Xcb] help with xcb hang

Fabio Coatti fabio.coatti at gmail.com
Fri Dec 25 09:37:42 PST 2015


Hi all,
I'm experiencing a lockup that shows itself in libxcb, while I'm not sure the 
problem lies in libxcb, maybe some expert here can give me some suggestions. 

Scenario: I noticed some lockups when using xscreensaver with some (admittedly 
very old) screen hacks from rss-glx package.

Basically the process remains running (shown in process list) even if 
xscreensaver tries to kill it; using xscreensaver-demo utility, the lockup can 
be reproduced every time on my system: the screenhack hangs when exiting from 
it and it takes a kill -9 to exit.

looking at backtrace (see below), the process seems to be hung in poll() 
called from xcb_conn.c:459
====
        ret = poll(&fd, 1, -1);
        /* If poll() returns an event we didn't expect, such as POLLNVAL, 
treat
         * it as if it failed. */
        if(ret >= 0 && (fd.revents & ~fd.events))
        {
            ret = -1;
            break;
        }
====

After some investigations it seems that the lockup appears when poll() is 
interrupted by the term signal sent to the application. My suspect is that the 
poll() is restarted by the OS, but meanwhile the polled resource is 
disappeared or otherwise modified by the caller function and when restarted 
poll() hangs forever waiting for something that will never arrive.
The caller, in fact, redefines TERM signal and uses it to perform some cleanup 
before exiting with a return, and poll() is restarted when SIGTERM is issued.

Basically, what I suspect is that xscreensaver program, when changing 
screenhack, closes or modifies the window used by the running screenhack and 
sends a TERM to the hack, that is spending most of his time in poll() syscall 
and causing the behaviour described above.

My question is then quite simple: 
to remain stuck in poll() call is the expected behaviour from libxcb point of 
view, and then is the caller application to be fixed, or libxcb should do 
something different, like bailing out in case poll() returns EINTR and the 
polled resource is no longer available or something like this?

Many thanks in advance for any hint or suggestion.

And BTW: merry Xmas to everyone here :)




 #0  0x00007f81ff8c84f0 in poll () from /lib64/libc.so.6                                                                                                                                                                                                                        
No symbol table info available.                                                                                                                                                                                                                                                
#1  0x00007f81fd91cac2 in poll (__timeout=-1, __nfds=1, __fds=0x7ffda10e45f0) 
at /usr/include/bits/poll2.h:46                                                                                                                                                                  
No locals.                                                                                                                                                                                                                                                                     
#2  _xcb_conn_wait (c=c at entry=0x19a2080, cond=cond at entry=0x7ffda10e4710, 
vector=vector at entry=0x0, count=count at entry=0x0) at /var/tmp/portage/x11-
libs/libxcb-1.11.1/work/libxcb-1.11.1/src/xcb_conn.c:459                                                                      
        ret = <optimized out>                                                                                                                                                                                                                                                  
        fd = {fd = 3, events = 1, revents = 0}                                                                                                                                                                                                                                 
#3  0x00007f81fd91e477 in wait_for_reply (c=c at entry=0x19a2080, request=1539, 
e=e at entry=0x7ffda10e47e0) at /var/tmp/portage/x11-
libs/libxcb-1.11.1/work/libxcb-1.11.1/src/xcb_in.c:516                                                                                          
        cond = {__data = {__lock = 0, __futex = 0, __total_seq = 0, 
__wakeup_seq = 0, __woken_seq = 0, __mutex = 0x0, __nwaiters = 0, 
__broadcast_seq = 0}, __size = '\000' <repeats 47 times>, __align = 0}                                                                   
        reader = {request = 1539, data = 0x7ffda10e4710, next = 0x0}                                                                                                                                                                                                           
        ret = 0x0                                                                                                                                                                                                                                                              
#4  0x00007f81fd91e581 in xcb_wait_for_reply (c=0x19a2080, request=1539, 
e=0x7ffda10e47e0) at /var/tmp/portage/x11-
libs/libxcb-1.11.1/work/libxcb-1.11.1/src/xcb_in.c:546                                                                                                      
        ret = <optimized out>                                                                                                                                                                                                                                                  
#5  0x00007f8200457b07 in _XReply () from /usr/lib64/libX11.so.6                                                                                                                                                                                                               
No symbol table info available.                                                                                                                                                                                                                                                
#6  0x00007f820079843a in ?? () from /usr/lib64/libGL.so.1                                                                                                                                                                                                                     
No symbol table info available.                                                                                                                                                                                                                                                
#7  0x00007f8200798777 in ?? () from /usr/lib64/libGL.so.1                                                                                                                                                                                                                     
No symbol table info available.                                                                                                                                                                                                                                                
#8  0x00007f81fc8ae54b in ?? () from /usr/lib64/dri/i965_dri.so                                                                                                                                                                                                                
No symbol table info available.                                                                                                                                                                                                                                                
#9  0x00007f81fc8aea51 in ?? () from /usr/lib64/dri/i965_dri.so                                                                                                                                                                                                                
No symbol table info available.                                                                                                                                                                                                                                                
#10 0x00007f81fc8a0940 in ?? () from /usr/lib64/dri/i965_dri.so                                                                                                                                                                                                                
No symbol table info available.                                                                                                                                                                                                                                                
#11 0x0000000000403276 in hack_draw (XStuff=0x19a0c20, currentTime=<optimized 
out>, frameTime=0,0209369995) at feedback.cpp:89                                                                                                                                                 
        newTotalV = {_vptr.rsVec = 0x0, v = {-4,82120566e-19, 4,59135442e-41, 
1,40129846e-45}}                                                                                                                                                                                 
        totalVScalar = <optimized out>  
-- 
Fabio


More information about the Xcb mailing list