xlib/ xcb 死锁或阻塞
我有一个使用 xlib 和 cairo 开发的程序。只是为了参考,我在 cairo 和 xlib 之间混合调用,尽管我不确定这是否可能是错误的原因。 在某些情况下我会遇到僵局或阻塞。 我有三个与 xlib 一起使用的线程。一个是主 UI 线程,它调用 xlib 和 cairo,另一个使用它仅发送 XClientMessage,第三个调用一些 xlib,例如 XCopyArea,并最后发送 XClientMessage(这些用于某些动画)。 我在程序的开头调用了 InitThreads。我还使用 XLockDisplay 保护所有 xlib 调用(cairo 调用也使用 XLockDisplay 保护)。 我使用的是ubuntu 10.10。 堆栈跟踪是:
(gdb) 线程 1
__kernel_vsyscall() 中的 0
1 in poll () from /lib/tls/i686/cmov/libc.so.6
2 在 ?? () 来自 /usr/lib/libxcb.so.1
3 在 ?? () 来自 /usr/lib/libxcb.so.1
4 位于 /usr/lib/libxcb.so.1 中的 xcb_writev()
5 中的 _XSend () 来自 /usr/lib/libX11.so.6
6 在 _XEventsQueued () 中,来自 /usr/lib/libX11.so.6
7 在 XPending () 中,来自 /usr/lib/libX11.so.6
(gdb) 线程 6
__kernel_vsyscall()中的0
1.在__lll_lock_wait()中
/lib/tls/i686/cmov/libpthread.so.0
2 在 _L_lock_752 () 中,来自 /lib/tls/i686/cmov/libpthread.so.0
3 中的 pthread_mutex_lock() 来自 /lib/tls/i686/cmov/libpthread.so.0
4 在 ?? () 来自 /usr/lib/libX11.so.6
5 中的 XLockDisplay() 来自 /usr/lib/libX11.so.6
(gdb) 线程 7
__kernel_vsyscall()中的0
1 在 __lll_lock_wait () 中,来自 /lib/tls/i686/cmov/libpthread.so.0
2 在 _L_lock_752 () 中,来自 /lib/tls/i686/cmov/libpthread.so.0
3 中的 pthread_mutex_lock() 来自 /lib/tls/i686/cmov/libpthread.so.0
4 在 ?? () 来自 /usr/lib/libX11.so.6
5 中的 XLockDisplay() 来自 /usr/lib/libX11.so.6
其中线程 1 是主 ui 线程,当前在事件循环中调用 XPending(它已经调用了 XLockDisplay),线程 7 是刚刚发送 XClientMessage 的线程,线程 6 是对 XCopyArea 进行了一些调用的线程,现在大约是调用 XSendMessage(它与线程 7 一起等待线程 1 完成)。但线程 1 似乎从未从 poll 中返回。 我不确定它是否相关(我绝不是linux或libc方面的专家),但我有另一个线程在轮询中等待(它是用于TCP/IP网络通信的线程) (gdb) 线程 2
__kernel_vsyscall()中的0
1 in poll () from /lib/tls/i686/cmov/libc.so.6
有人经历过类似的死锁/阻塞吗?这可能是 xcb 中的错误吗?是否值得尝试在没有 xcb 的情况下编译 xlib? 谢谢
I’ve a program developed using xlib and cairo. Just for the reference I do mix calls between cairo and xlib, although I’m not sure If that might be the cause of the error.
I get a deadlock or a block in some situations.
I’ve three threads that work with xlib. One is the main UI thread which makes calls to both xlib and cairo, another uses it just to send a XClientMessage and third makes some xlib calls like XCopyArea and at the end send an XClientMessage (those are for some animations).
I’ve called InitThreads in the beginning of the program. I’ve also guarded all xlib calls with XLockDisplay (cairo calls are also guarded with XLockDisplay).
I’m using ubuntu 10.10.
The stack traces are:
(gdb) thread 1
0 in __kernel_vsyscall ()
1 in poll () from /lib/tls/i686/cmov/libc.so.6
2 in ?? () from /usr/lib/libxcb.so.1
3 in ?? () from /usr/lib/libxcb.so.1
4 in xcb_writev () from /usr/lib/libxcb.so.1
5 in _XSend () from /usr/lib/libX11.so.6
6 in _XEventsQueued () from /usr/lib/libX11.so.6
7 in XPending () from /usr/lib/libX11.so.6
(gdb) thread 6
0 in __kernel_vsyscall ()
1 in __lll_lock_wait () from
/lib/tls/i686/cmov/libpthread.so.0
2 in _L_lock_752 () from /lib/tls/i686/cmov/libpthread.so.0
3 in pthread_mutex_lock () from /lib/tls/i686/cmov/libpthread.so.0
4 in ?? () from /usr/lib/libX11.so.6
5 in XLockDisplay () from /usr/lib/libX11.so.6
(gdb) thread 7
0 in __kernel_vsyscall ()
1 in __lll_lock_wait () from /lib/tls/i686/cmov/libpthread.so.0
2 in _L_lock_752 () from /lib/tls/i686/cmov/libpthread.so.0
3 in pthread_mutex_lock () from /lib/tls/i686/cmov/libpthread.so.0
4 in ?? () from /usr/lib/libX11.so.6
5 in XLockDisplay () from /usr/lib/libX11.so.6
Where thread 1 is the main ui thread, currently calling XPending (it has already called XLockDisplay) in an event loop, thead 7 is the thread that just sends XClientMessage and thread 6 is the thread that has made some calls to XCopyArea and is now about to make a call to XSendMessage (it is waiting along with thread 7 for thread 1 to finish). But thread 1 never seem to return from poll.
I’m not sure it is relevant (I’m by no means an expert on linux or libc), but I’ve another thread waiting in poll (it’s a thread for TCP/IP network communication)
(gdb) thread 2
0 in __kernel_vsyscall ()
1 in poll () from /lib/tls/i686/cmov/libc.so.6
Has anyone experience similar deadlock/block? Can this be a bug in xcb and is it worth trying to compile xlib without xcb?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚遇到一个问题,其中 __lll_lock_wait () 中有 1
作为一个麻烦制造者也是如此。那是在我的代码的 I/O 部分,也许你的问题就在那里?
I just was running into an issue that had 1 in __lll_lock_wait () from
as a troublemaker as well. That was in an I/O portion of my code, perhaps your problem is there?