Summary: | libX11/XCB threads: simultaneous event-wait with other Xlib request breaks | ||
---|---|---|---|
Product: | xorg | Reporter: | Diego Elio Pettenò <flameeyes> |
Component: | Lib/Xlib | Assignee: | Jamey Sharp <jamey> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | major | ||
Priority: | high | CC: | josh, x |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Bug Depends on: | |||
Bug Blocks: | 6666 |
Description
Diego Elio Pettenò
2006-10-12 16:44:06 UTC
Sorry I haven't responded to this bug. I looked at it for a little while and was baffled. I'm getting back to it now and hope to have an answer/fix for you soon. I gather you were able to reliably reproduce this bug? Just to be sure, can you reproduce it now, and also with a current git clone of libX11? I also wonder if Kaffeine is multi-threaded, as I've thought there might be a race in process_responses... Not sure if Kaffeine itself is threaded (could check but it's late now and I'm feverish), but xine is for sure. And yes, this can be reproduced with two days ago's git version (will confirm tomorrow with very current ones). OK, now I know what's wrong, but I haven't decided how to fix it yet. It's a threading bug, and the following patch masks the problem. You could apply it if you want until we get a real fix in: I've verified that kaffeine will play stuff happily with the patch applied. I'm making this a blocker for 7.2, as it's a race condition that affects any of the three programs in the world that actually make Xlib calls from more than one thread. diff --git a/src/xcb_io.c b/src/xcb_io.c index 7717679..7a038d9 100644 --- a/src/xcb_io.c +++ b/src/xcb_io.c @@ -106,6 +106,8 @@ static void process_responses(Display *d UnlockDisplay(dpy); event = xcb_wait_for_event(c); LockDisplay(dpy); + /* FIXME: need equivalent of reply/event awaiters CV lists here, not this hack */ + current_request = dpy->request; } else event = xcb_poll_for_event(c); Exercise for the reader: identify why adding this one line helps. Bonus question: explain why it's the wrong fix. Extra bonus points: provide the right fix. After extensive root cause analysis, a lot of thought, and about 80 new lines of code, Josh and I believe we have correctly fixed this bug without introducing regressions. When you get a chance, please re-test with a current git checkout of libX11. Thanks! Tested this last night, and now it works as a charm (on FreeBSD with the libxcb patch), thanks! |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.