[Xcb] Troubleshooting xcb/X11 deadlocks

Bill Soudan bills at soudan.net
Mon Dec 7 08:16:41 PST 2015


Hi all,

I'm having some trouble with the latest Synergy client that I'm trying to
sort out... it appears to be deadlocking when making X11 and xcb calls in
two different threads.  Can anyone point me in the right direction?  It
looks like there's a lot of history with deadlocks between xcb/X11, but
maybe Synergy's doing something wrong here, I'm not sure.  I've attached
two of the typical deadlocks that I see.

Thanks,
Bill

Deadlock example 1:

(gdb) where
#0  0x00007ffff7bcb91f in pthread_cond_wait@@GLIBC_2.3.2 () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libpthread.so.0
#1  0x00007ffff702f85d in _XReply () from
/nix/store/nz63mdn3nsridd4fbxjrzf49rpv0mbsp-libX11-1.6.3/lib/libX11.so.6
#2  0x00007ffff702b3ed in XSync () from
/nix/store/nz63mdn3nsridd4fbxjrzf49rpv0mbsp-libX11-1.6.3/lib/libX11.so.6
#3  0x0000000000506708 in XWindowsUtil::ErrorLock::install
(this=0x7fffffffbad0,
    handler=0x5067be <XWindowsUtil::ErrorLock::ignoreHandler(_XDisplay*,
XErrorEvent*, void*)>, data=0x0)
    at /home/bsoudan/src/synergy/src/lib/platform/XWindowsUtil.cpp:1754
#4  0x000000000050660a in XWindowsUtil::ErrorLock::ErrorLock
(this=0x7fffffffbad0, display=0x7ac480)
    at /home/bsoudan/src/synergy/src/lib/platform/XWindowsUtil.cpp:1721
#5  0x00000000005057de in XWindowsUtil::getWindowProperty
(display=0x7ac480, window=2097156, property=295, data=0x0,
type=0x7fffffffbb88, format=0x0,
    deleteProperty=false) at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsUtil.cpp:1306
#6  0x0000000000513ebe in XWindowsScreenSaver::isXScreenSaver
(this=0x7b8010, w=2097156)
    at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsScreenSaver.cpp:383
#7  0x00000000005138b3 in XWindowsScreenSaver::handleXEvent (this=0x7b8010,
xevent=0x7bd498)
    at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsScreenSaver.cpp:189
#8  0x00000000004fcc4f in XWindowsScreen::handleSystemEvent (this=0x7ac1f0,
event=...) at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsScreen.cpp:1259
#9  0x000000000050575e in TMethodEventJob<XWindowsScreen>::run
(this=0x7bd110, event=...)
    at
/home/bsoudan/src/synergy/src/lib/platform/../base/TMethodEventJob.h:69
#10 0x00000000004d2f88 in EventQueue::dispatchEvent (this=0x7fffffffc210,
event=...) at /home/bsoudan/src/synergy/src/lib/base/EventQueue.cpp:271
#11 0x00000000004d279d in EventQueue::loop (this=0x7fffffffc210) at
/home/bsoudan/src/synergy/src/lib/base/EventQueue.cpp:129
#12 0x00000000004e6e27 in ClientApp::mainLoop (this=0x7fffffffc060) at
/home/bsoudan/src/synergy/src/lib/synergy/ClientApp.cpp:494
#13 0x00000000004e6fde in ClientApp::standardStartup (this=0x7fffffffc060,
argc=3, argv=0x7fffffffc578)
    at /home/bsoudan/src/synergy/src/lib/synergy/ClientApp.cpp:532
#14 0x00000000004eb3f1 in standardStartupStatic (argc=3,
argv=0x7fffffffc578) at
/home/bsoudan/src/synergy/src/lib/synergy/unix/AppUtilUnix.cpp:33
#15 0x00000000004e708d in ClientApp::runInner (this=0x7fffffffc060, argc=3,
argv=0x7fffffffc578, outputter=0x0,
    startup=0x4eb3b8 <standardStartupStatic(int, char**)>) at
/home/bsoudan/src/synergy/src/lib/synergy/ClientApp.cpp:552
#16 0x00000000004eb444 in AppUtilUnix::run (this=0x7fffffffc0a0, argc=3,
argv=0x7fffffffc578)
    at /home/bsoudan/src/synergy/src/lib/synergy/unix/AppUtilUnix.cpp:39
#17 0x00000000004e425d in App::run (this=0x7fffffffc060, argc=3,
argv=0x7fffffffc578) at
/home/bsoudan/src/synergy/src/lib/synergy/App.cpp:118
#18 0x00000000004be5fb in main (argc=3, argv=0x7fffffffc578) at
/home/bsoudan/src/synergy/src/cmd/synergyc/synergyc.cpp:49
(gdb) threads
Undefined command: "threads".  Try "help".
(gdb) info threads
  Id   Target Id         Frame
  28   Thread 0x7fffde7f4700 (LWP 24491) "synergyc" 0x00007ffff5cd94bd in
poll () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libc.so.6
  3    Thread 0x7ffff3f27700 (LWP 17652) "synergyc" 0x00007ffff7bcbcc8 in
pthread_cond_timedwait@@GLIBC_2.3.2 ()
   from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libpthread.so.0
  2    Thread 0x7ffff4728700 (LWP 17651) "synergyc" 0x00007ffff7bcf119 in
do_sigwait ()
   from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libpthread.so.0
* 1    Thread 0x7ffff7fe8780 (LWP 17647) "synergyc" 0x00007ffff7bcb91f in
pthread_cond_wait@@GLIBC_2.3.2 ()
   from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libpthread.so.0
(gdb) thread 28
[Switching to thread 28 (Thread 0x7fffde7f4700 (LWP 24491))]
#0  0x00007ffff5cd94bd in poll () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libc.so.6
(gdb) where
#0  0x00007ffff5cd94bd in poll () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libc.so.6
#1  0x00007ffff4d45202 in _xcb_conn_wait () from
/nix/store/8lin073px65ziw1knd47183pgqy55h2s-libxcb-1.11/lib/libxcb.so.1
#2  0x00007ffff4d46c9f in xcb_wait_for_event () from
/nix/store/8lin073px65ziw1knd47183pgqy55h2s-libxcb-1.11/lib/libxcb.so.1
#3  0x00007ffff702f4a8 in _XReadEvents () from
/nix/store/nz63mdn3nsridd4fbxjrzf49rpv0mbsp-libX11-1.6.3/lib/libX11.so.6
#4  0x00007ffff7017bf9 in XIfEvent () from
/nix/store/nz63mdn3nsridd4fbxjrzf49rpv0mbsp-libX11-1.6.3/lib/libX11.so.6
#5  0x0000000000505cc8 in XWindowsUtil::getCurrentTime (display=0x7ac480,
window=2097156) at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsUtil.cpp:1455
#6  0x0000000000517b50 in XWindowsClipboard::motifLockClipboard
(this=0x7bc270) at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsClipboard.cpp:622
#7  0x0000000000516c05 in XWindowsClipboard::open (this=0x7bc270,
time=30619224) at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsClipboard.cpp:329
#8  0x0000000000522728 in IClipboard::copy (dst=0x7fffde7f3d40,
src=0x7bc270, time=30619224) at
/home/bsoudan/src/synergy/src/lib/synergy/IClipboard.cpp:124
#9  0x00000000004facd0 in XWindowsScreen::getClipboard (this=0x7ac1f0, id=0
'\000', clipboard=0x7fffde7f3d40)
    at /home/bsoudan/src/synergy/src/lib/platform/XWindowsScreen.cpp:499
#10 0x00000000004ea410 in synergy::Screen::getClipboard (this=0x7aa320,
id=0 '\000', clipboard=0x7fffde7f3d40)
    at /home/bsoudan/src/synergy/src/lib/synergy/Screen.cpp:478
#11 0x00000000004f299c in Client::sendClipboard (this=0x7bd6c0, id=0
'\000') at /home/bsoudan/src/synergy/src/lib/client/Client.cpp:399
#12 0x00000000004f475d in Client::sendClipboardThread (this=0x7bd6c0) at
/home/bsoudan/src/synergy/src/lib/client/Client.cpp:770
#13 0x00000000004f5062 in TMethodJob<Client>::run (this=0x8112d0) at
/home/bsoudan/src/synergy/src/lib/client/../base/TMethodJob.h:66
#14 0x000000000054ae57 in Thread::threadFunc (vjob=0x8112d0) at
/home/bsoudan/src/synergy/src/lib/mt/Thread.cpp:157
#15 0x00000000004c1c7a in ArchMultithreadPosix::doThreadFunc
(this=0x7fffffffc110, thread=0x814440)
    at
/home/bsoudan/src/synergy/src/lib/arch/unix/ArchMultithreadPosix.cpp:726
#16 0x00000000004c1be1 in ArchMultithreadPosix::threadFunc (vrep=0x814440)
at /home/bsoudan/src/synergy/src/lib/arch/unix/ArchMultithreadPosix.cpp:707
#17 0x00007ffff7bc7484 in start_thread () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libpthread.so.0
#18 0x00007ffff5ce205d in clone () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libc.so.6

Deadlock example 2:

Program received signal SIGUSR1, User defined signal 1.
0x00007ffff7bcb91f in pthread_cond_wait@@GLIBC_2.3.2 () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libpthread.so.0
(gdb) where
#0  0x00007ffff7bcb91f in pthread_cond_wait@@GLIBC_2.3.2 () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libpthread.so.0
#1  0x00007ffff702f85d in _XReply () from
/nix/store/nz63mdn3nsridd4fbxjrzf49rpv0mbsp-libX11-1.6.3/lib/libX11.so.6
#2  0x00007ffff7016876 in XGetWindowProperty () from
/nix/store/nz63mdn3nsridd4fbxjrzf49rpv0mbsp-libX11-1.6.3/lib/libX11.so.6
#3  0x0000000000505850 in XWindowsUtil::getWindowProperty
(display=0x7ac480, window=2097156, property=295, data=0x0,
type=0x7fffffffbb88, format=0x0,
    deleteProperty=false) at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsUtil.cpp:1320
#4  0x0000000000513ebe in XWindowsScreenSaver::isXScreenSaver
(this=0x7b8010, w=2097156)
    at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsScreenSaver.cpp:383
#5  0x00000000005138b3 in XWindowsScreenSaver::handleXEvent (this=0x7b8010,
xevent=0x7bd518)
    at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsScreenSaver.cpp:189
#6  0x00000000004fcc4f in XWindowsScreen::handleSystemEvent (this=0x7ac1f0,
event=...) at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsScreen.cpp:1259
#7  0x000000000050575e in TMethodEventJob<XWindowsScreen>::run
(this=0x7bd190, event=...)
    at
/home/bsoudan/src/synergy/src/lib/platform/../base/TMethodEventJob.h:69
#8  0x00000000004d2f88 in EventQueue::dispatchEvent (this=0x7fffffffc210,
event=...) at /home/bsoudan/src/synergy/src/lib/base/EventQueue.cpp:271
#9  0x00000000004d279d in EventQueue::loop (this=0x7fffffffc210) at
/home/bsoudan/src/synergy/src/lib/base/EventQueue.cpp:129
#10 0x00000000004e6e27 in ClientApp::mainLoop (this=0x7fffffffc060) at
/home/bsoudan/src/synergy/src/lib/synergy/ClientApp.cpp:494
#11 0x00000000004e6fde in ClientApp::standardStartup (this=0x7fffffffc060,
argc=3, argv=0x7fffffffc578)
    at /home/bsoudan/src/synergy/src/lib/synergy/ClientApp.cpp:532
#12 0x00000000004eb3f1 in standardStartupStatic (argc=3,
argv=0x7fffffffc578) at
/home/bsoudan/src/synergy/src/lib/synergy/unix/AppUtilUnix.cpp:33
#13 0x00000000004e708d in ClientApp::runInner (this=0x7fffffffc060, argc=3,
argv=0x7fffffffc578, outputter=0x0,
    startup=0x4eb3b8 <standardStartupStatic(int, char**)>) at
/home/bsoudan/src/synergy/src/lib/synergy/ClientApp.cpp:552
#14 0x00000000004eb444 in AppUtilUnix::run (this=0x7fffffffc0a0, argc=3,
argv=0x7fffffffc578)
    at /home/bsoudan/src/synergy/src/lib/synergy/unix/AppUtilUnix.cpp:39
#15 0x00000000004e425d in App::run (this=0x7fffffffc060, argc=3,
argv=0x7fffffffc578) at
/home/bsoudan/src/synergy/src/lib/synergy/App.cpp:118
#16 0x00000000004be5fb in main (argc=3, argv=0x7fffffffc578) at
/home/bsoudan/src/synergy/src/cmd/synergyc/synergyc.cpp:49
(gdb) info threads
  Id   Target Id         Frame
  18   Thread 0x7fffe37fe700 (LWP 7916) "synergyc" 0x00007ffff5cd94bd in
poll () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libc.so.6
  3    Thread 0x7ffff3f27700 (LWP 2751) "synergyc" 0x00007ffff7bcbcc8 in
pthread_cond_timedwait@@GLIBC_2.3.2 ()
   from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libpthread.so.0
  2    Thread 0x7ffff4728700 (LWP 2750) "synergyc" 0x00007ffff7bcf119 in
do_sigwait ()
   from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libpthread.so.0
* 1    Thread 0x7ffff7fe8780 (LWP 2739) "synergyc" 0x00007ffff7bcb91f in
pthread_cond_wait@@GLIBC_2.3.2 ()
   from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libpthread.so.0
(gdb) thread 18
[Switching to thread 18 (Thread 0x7fffe37fe700 (LWP 7916))]
#0  0x00007ffff5cd94bd in poll () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libc.so.6
(gdb) where
#0  0x00007ffff5cd94bd in poll () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libc.so.6
#1  0x00007ffff4d45202 in _xcb_conn_wait () from
/nix/store/8lin073px65ziw1knd47183pgqy55h2s-libxcb-1.11/lib/libxcb.so.1
#2  0x00007ffff4d46c9f in xcb_wait_for_event () from
/nix/store/8lin073px65ziw1knd47183pgqy55h2s-libxcb-1.11/lib/libxcb.so.1
#3  0x00007ffff702f4a8 in _XReadEvents () from
/nix/store/nz63mdn3nsridd4fbxjrzf49rpv0mbsp-libX11-1.6.3/lib/libX11.so.6
#4  0x00007ffff7017bf9 in XIfEvent () from
/nix/store/nz63mdn3nsridd4fbxjrzf49rpv0mbsp-libX11-1.6.3/lib/libX11.so.6
#5  0x0000000000505cc8 in XWindowsUtil::getCurrentTime (display=0x7ac480,
window=2097156) at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsUtil.cpp:1455
#6  0x0000000000517b50 in XWindowsClipboard::motifLockClipboard
(this=0x7bc2f0) at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsClipboard.cpp:622
#7  0x0000000000516c05 in XWindowsClipboard::open (this=0x7bc2f0,
time=37373710) at
/home/bsoudan/src/synergy/src/lib/platform/XWindowsClipboard.cpp:329
#8  0x0000000000522728 in IClipboard::copy (dst=0x7fffe37fdd40,
src=0x7bc2f0, time=37373710) at
/home/bsoudan/src/synergy/src/lib/synergy/IClipboard.cpp:124
#9  0x00000000004facd0 in XWindowsScreen::getClipboard (this=0x7ac1f0, id=0
'\000', clipboard=0x7fffe37fdd40)
    at /home/bsoudan/src/synergy/src/lib/platform/XWindowsScreen.cpp:499
#10 0x00000000004ea410 in synergy::Screen::getClipboard (this=0x7aa320,
id=0 '\000', clipboard=0x7fffe37fdd40)
    at /home/bsoudan/src/synergy/src/lib/synergy/Screen.cpp:478
#11 0x00000000004f299c in Client::sendClipboard (this=0x7bd740, id=0
'\000') at /home/bsoudan/src/synergy/src/lib/client/Client.cpp:399
#12 0x00000000004f475d in Client::sendClipboardThread (this=0x7bd740) at
/home/bsoudan/src/synergy/src/lib/client/Client.cpp:770
#13 0x00000000004f5062 in TMethodJob<Client>::run (this=0x806fe0) at
/home/bsoudan/src/synergy/src/lib/client/../base/TMethodJob.h:66
#14 0x000000000054ae57 in Thread::threadFunc (vjob=0x806fe0) at
/home/bsoudan/src/synergy/src/lib/mt/Thread.cpp:157
#15 0x00000000004c1c7a in ArchMultithreadPosix::doThreadFunc
(this=0x7fffffffc110, thread=0x80bf00)
    at
/home/bsoudan/src/synergy/src/lib/arch/unix/ArchMultithreadPosix.cpp:726
#16 0x00000000004c1be1 in ArchMultithreadPosix::threadFunc (vrep=0x80bf00)
at /home/bsoudan/src/synergy/src/lib/arch/unix/ArchMultithreadPosix.cpp:707
#17 0x00007ffff7bc7484 in start_thread () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libpthread.so.0
#18 0x00007ffff5ce205d in clone () from
/nix/store/npfsi1d9ka8zwnxzn3sr08hbwvpapyk7-glibc-2.21/lib/libc.so.6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20151207/a490a2b7/attachment-0001.html>


More information about the Xcb mailing list