Bug 46691 - xscope-1.3.1 deadlocks if client or server would block
Summary: xscope-1.3.1 deadlocks if client or server would block
Alias: None
Product: xorg
Classification: Unclassified
Component: App/other (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) FreeBSD
: medium normal
Assignee: Alan Coopersmith
QA Contact: Xorg Project Team
Whiteboard: 2012BRB_Reviewed
Depends on:
Reported: 2012-02-27 13:21 UTC by Peter Jeremy
Modified: 2012-07-08 11:21 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Use correct write FD to select() on. (328 bytes, patch)
2012-02-27 13:21 UTC, Peter Jeremy
no flags Details | Splinter Review

Description Peter Jeremy 2012-02-27 13:21:51 UTC
Created attachment 57733 [details] [review]
Use correct write FD to select() on.

FlushFD() contains logic to handle the Xclient or Xserver blocking on a write() by changing the global read and write fd_set's so that MainLoop() will select() on the blocking write FD instead of the peer read FD.  Unfortunately, the code contains a logic error so that it winds up select()ing for write on the peer FD instead of the blocked FD.

The result is that xscope and the traced Xclient deadlock since the outstanding data is never written.  With X.org 7.5.1 on an old 3.2GHz HTT P4 and a SMP kernel, I could trigger this about 50% of the time using xscope to trace an AF_UNIX connection from xterm.  Debug output from xscope with the attached patch shows that EWOULDBLOCK is still returned on occasion but is now handled correctly.
Comment 1 Alan Coopersmith 2012-07-08 11:21:42 UTC
Thanks for the patch - pushed to git master for next release:

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.