Bug 2443 - luit deadlock with vi and less
Summary: luit deadlock with vi and less
Status: RESOLVED DUPLICATE of bug 8490
Alias: None
Product: xorg
Classification: Unclassified
Component: * Other (show other bugs)
Version: 6.8.2
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Xorg Project Team
QA Contact:
URL: https://bugzilla.redhat.com/bugzilla/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-01 02:43 UTC by Jan "Yenya" Kasprzak
Modified: 2006-10-31 08:15 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Jan "Yenya" Kasprzak 2005-02-01 02:43:47 UTC
[This bug has been originally reported to Red Hat Bugzilla under the following
URL: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=141992 I am
re-reporting it upstream]

Description of problem:
The luit(1) program sometimes deadlocks when running commands like
vi(1) or less(1).

Version-Release number of selected component (if applicable):
xorg-x11-6.8.1-12.FC3.1

How reproducible:
non-deterministic, probably a race condition.

Steps to Reproduce:
1. run "luit vi"
2. if vi starts up, type ":q<enter>" and repeat from step 1.

Actual results:
sometimes no output is written to the terminal, and CPU is idle.


Expected results:
vi should start up every time

Additional info:
- this is totally nondeterministic. Sometimes vi starts up 5 times in
a row, sometimes luit locks up 5+ times in a row.

- it happens only when running full-screen applications (I have seen
this with "luit vi file", "luit less file", and "luit slrn" so far,
and I haven't seen this with "luit ssh <host>" even though I often run
ssh under luit).

- this is probably some race condition in luit, because I have not
been able to reproduce this when running "strace -f -o /tmp/strace
luit vi".

- however, I can reproduce this using strace without the -f switch. I
ran "strace -o /dev/pts/22 vi", and on pts/22 the text ended with the
following lines:

[...]
ioctl(3, TIOCSPTLCK, [0])               = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
...}) = 0ioctl(3, TIOCGPTN, [30])                = 0
stat("/dev/pts/30", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 30),
...}) = 0
getuid()                                = 11561
getgid()                                = 10000
stat("/dev/pts/30", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 30),
...}) = 0
getgid()                                = 10000
getuid()                                = 11561
chown("/dev/pts/30", 11561, 10000)      = 0
getuid()                                = 11561
geteuid()                               = 11561
getgid()                                = 10000
getegid()                               = 10000
setuid(11561)                           = 0
setgid(10000)                           = 0
clone(child_stack=0,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x2a9556c3b0) = 26487
rt_sigaction(SIGWINCH, {0x401aa0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGCHLD, {0x401ab0, [], 0x4000000}, NULL, 8) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
...}) = 0
ioctl(3, SNDCTL_TMR_CONTINUE or TCSETSF

(and yes, the output ended with "TCSETF" in the middle of the line (no
"<unfinished>" or anything else was printed by strace). When I hit
Ctrl+C, the strace continues by this (I am repeating the last line up
to the "TCSETF" string):

ioctl(3, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 opost isig icanon
echo ...}) = -1 EINTR (Interrupted system call)
--- SIGINT (Interrupt) @ 0 (0) ---
+++ killed by SIGINT +++

- when I try to strace the already locked-up luit, I get this:

$ strace -p 26584
Process 26584 attached - interrupt to quit
write(2, "Couldn\'t copy terminal settings\n", 32) = 32
exit_group(0x1, 0x1, 0x39d3c64d60, 0x1, 0x3cProcess 26584 detached

(and of course luit prints "Couldn't copy terminal settings" to stderr
and finishes with exit status "1").

- when I try to strace the process running inside luit, it is waiting
for the terminal input:

$ strace -p 26664    # This is a PID of the "vi" process
Process 26664 attached - interrupt to quit
select(1, [0], NULL, [0], NULL

so it is waiting inside select for reading from stdin.

More info from some other users who see the same problem is in the Red Hat
Bugzilla (URL mentioned above).
Comment 1 Daniel Glöckner 2005-02-28 14:54:22 UTC
I get this bug in Linux 2.4.28 with xterm -lc -e mutt.
It blocks while mutt is doing a ioctl(1,TCSETSW,) after it has written some bytes.
The proposed patch for bug #1400 using pipes to synchronize the pty
initialization fixes this one as well.
Comment 2 Alexander E. Patrakov 2005-04-29 08:26:45 UTC
This looks the same as http://bugs.xfree86.org/show_bug.cgi?id=1093 
Comment 3 FreeDesktop Bugzilla Database Corruption Fix User 2005-05-31 06:26:28 UTC
It does not require a fullscreen application, in UTF-8 locale
  luit date
also hangs.
Comment 4 Erik Andren 2006-04-02 18:44:02 UTC
Whats the status of this bug as of today?

Comment 5 Jan "Yenya" Kasprzak 2006-04-02 19:27:35 UTC
Still not fixed (tested today on a Fedora Core 5 i386 system):
xorg-x11-apps-1.0.1-2
libX11-1.0.0-3
Comment 6 Erik Andren 2006-04-02 19:40:21 UTC
Is it possible to try to see if this patch from the xfree86 buzilla resolves the
issue?

http://bugs.xfree86.org/attachment.cgi?id=1301

Comment 7 Jan "Yenya" Kasprzak 2006-04-03 05:50:28 UTC
I have rebuild luit from the Fedora source RPM+this patch, and yes, it seems
that the deadlock problem is away.
Comment 8 Egmont Koblinger 2006-05-27 04:56:59 UTC
Either of the two patches solves the problem for me.
In XFree86 CVS, both of these patches are applied, however, they need some
manual work since they conflict a little bit (both apply cleanly on their
own without the other one, but they don't apply together, no matter in which
order you try).
Comment 9 Juliusz Chroboczek 2006-10-31 08:11:55 UTC

*** This bug has been marked as a duplicate of 8490 ***
Comment 10 Jan "Yenya" Kasprzak 2006-10-31 08:15:53 UTC
Why did you resolve an _older_ bug as a duplicate? :-(


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.