Bug 40372

Summary: Thread hangs in xcb_wait_for_reply() if another thread calls xcb_poll_for_event()
Product: XCB Reporter: Uli Schlachter <psychon>
Component: LibraryAssignee: xcb mailing list dummy <xcb>
Status: RESOLVED FIXED QA Contact: xcb mailing list dummy <xcb>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Test case causing hang
Proposed patch

Description Uli Schlachter 2011-08-25 05:28:07 UTC
Created attachment 50561 [details]
Test case causing hang

Hi,

thanks to sroedal who described this problem on IRC, I came up with the attached test case. The thread doing GetInputFocus requests here will hang in recv() almost instantly.

This happens because xcb_poll_for_event() can cause two threads to read data from the connection because this function doesn't synchronize with anything else. This means that the main thread will read the reply, but the thread waiting for the reply will still be struck in recv().

Uli
Comment 1 Uli Schlachter 2011-08-25 05:28:45 UTC
Created attachment 50562 [details] [review]
Proposed patch
Comment 2 Peter Harris 2011-09-02 10:05:17 UTC
Fixed in 5ceeaaa4294201b3f613c07f9ec610c0e5f673c7

Thanks, Uli.
Comment 3 wendal chen 2013-05-17 10:21:04 UTC
Is this ok to version 1.7 in opensuse 11.4 ?

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.