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
Status: RESOLVED FIXED
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
URL:
Whiteboard: 2012BRB_Reviewed
Keywords:
Depends on:
Blocks:
 
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:


Attachments
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:
http://cgit.freedesktop.org/xorg/app/xscope/commit/?id=c328376384a64f6dbdc476a1d6c5244aad8261ec


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.