Bug 26383

Summary: luit hangs (100% cpu) on process exit
Product: xorg Reporter: Geir Ove Myhr <gomyhr>
Component: App/luitAssignee: Xorg Project Team <xorg-team>
Status: CLOSED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: jch
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Output of strace
none
backtrace from gdb
none
check for POLLERR|POLLHUP in WaitForInput none

Description Geir Ove Myhr 2010-02-02 05:23:50 UTC
luit hangs and eats all available cpu when the process exits. I normally see this after a `luit ssh someserver`, but also `luit echo` has the same behaviour.

Ubuntu bug report: https://bugs.launchpad.net/ubuntu/+source/x11-utils/+bug/515679
Debian bug report: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560787

I'm running luit from git [3fb0af21816b9f89c4b33e7cac5aad6d90bcc6c7] (Dec 22, 2009) on Ubuntu Lucid 10.04 updated a few days ago.

Will attach strace and backtrace from an ssh session.
Comment 1 Geir Ove Myhr 2010-02-02 05:28:23 UTC
Created attachment 33002 [details]
Output of strace

Trimmed 73 MB of 
poll([{fd=0, events=POLLIN}, {fd=3, events=POLLIN}], 2, -1) = 1 ([{fd=3, revents=POLLHUP}])
from the file.

From the Debian bug report (Antti-Juhani Kaijanaho):
The immediate cause is that luit is not checking for POLLHUP for the pty in
waitForInput.  Instead it seems to be expecting a POLLIN with zero read.
Comment 2 Geir Ove Myhr 2010-02-02 05:30:05 UTC
Created attachment 33003 [details]
backtrace from gdb
Comment 3 Geir Ove Myhr 2010-02-02 05:31:54 UTC
Btw, I'm aware that the ssh password is visible in clear-text in the strace file. It was changed before and after the test.
Comment 4 Julien Cristau 2010-02-02 05:49:26 UTC
Created attachment 33004 [details] [review]
check for POLLERR|POLLHUP in WaitForInput

Attached patch indeed fixes this for me.  It would probably make sense to do the same in waitForOutput.
Comment 5 Julien Cristau 2010-02-02 06:02:53 UTC
Or just make the check 'if (pfd[i].revents)'...
Comment 6 Julien Cristau 2010-02-05 11:17:44 UTC
commit b7af1cef38d1995289acd1f2c13580b378ec0fc9
Author: Julien Cristau <jcristau@debian.org>
Date:   Tue Feb 2 14:45:17 2010 +0100

    poll: check for POLLERR|POLLHUP in WaitForInput
    
    X.Org bug#26383 <http://bugs.freedesktop.org/26383>
    
    Acked-by: Juliusz Chroboczek <jch@pps.jussieu.fr>
    Signed-off-by: Julien Cristau <jcristau@debian.org>

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.