* inconsistency in thread/signal interaction in 2.6.5 and previous vs. 2.6.6 and later (possibly a bug?)
@ 2004-08-16 10:01 Glyph Lefkowitz
2004-08-16 10:11 ` Martin Zwickel
2004-08-16 10:48 ` Jesper Juhl
0 siblings, 2 replies; 5+ messages in thread
From: Glyph Lefkowitz @ 2004-08-16 10:01 UTC (permalink / raw)
To: linux-kernel
Hello Kernel People,
Firstly, here is a brief example of some code that behaves very
differently on 2.6.5 and 2.6.6:
http://www.twistedmatrix.com/users/glyph/signal-bug.c
I have verified that it says "Completed" on kernel 2.6.5, 2.6.3 and
2.6.1, and says "Died" on 2.6.6, 2.6.7 and 2.6.8.1, so I am pretty sure
the difference is between 2.5.6 and 2.6.6.
As far as I understand it, kernel 2.6.5 would not deliver a signal to
anyone upon thread termination, but kernel 2.6.6 will deliver a SIGHUP
to the process's main thread, if the multi-threaded process's
controlling terminal is a pty.
This is most likely a muddled explanation, and it is certainly
incomplete. Please read the code to see what I mean. I am not the sort
of person who would normally be posting to the kernel mailing list, or
even writing code in C, for that matter.
I upgraded to the debian kernel 2.6.7 from 2.6.5; this had the
unfortunate side-effect of breaking Emacs integration with my unit
tests. It also seems to cause certain problems with the Conch SSH
server ( http://www.twistedmatrix.com/products/conch ) but I believe
emacs has rather a larger installed base.
Before anyone else has to tell me - yes, I am well aware that I should
not be sticking my hand into the signals/threads interaction blender if
I can avoid it, but in this case I can't :-).
On 2.6.5 and previous, the unit tests would run correctly; they all
passed. On 2.6.7, the tests would run correctly *on a terminal*, but
they would fail about halfway through if run in a 'M-x compile' buffer
in emacs. Coincidentally, they would fail at about the point where one
of the tests spawned a few threads to test the thread-safety of an API,
then immediately shut them down as part of the test-cleanup. Kaboom.
If it helps to know, asynchronous processes in emacs (e.g. M-x compile,
eshell) will get a SIGHUP if a thread terminates, but synchronous
processes (e.g. M-x shell-command, C-c C-c in a Python buffer) will not.
The critical difference between these *seems* to be the creation of a
PTY for a controlling terminal.
I am sorry I cannot accompany this with a patch to fix it. I am curious
though, is this even a bug, or just a stricter reading of some POSIX
threading standard?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: inconsistency in thread/signal interaction in 2.6.5 and previous vs. 2.6.6 and later (possibly a bug?)
2004-08-16 10:01 inconsistency in thread/signal interaction in 2.6.5 and previous vs. 2.6.6 and later (possibly a bug?) Glyph Lefkowitz
@ 2004-08-16 10:11 ` Martin Zwickel
2004-08-16 10:18 ` Paweł Sikora
2004-08-16 10:48 ` Jesper Juhl
1 sibling, 1 reply; 5+ messages in thread
From: Martin Zwickel @ 2004-08-16 10:11 UTC (permalink / raw)
To: Glyph Lefkowitz; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]
On Mon, 16 Aug 2004 06:01:05 -0400
Glyph Lefkowitz <glyph@divmod.com> bubbled:
> Hello Kernel People,
>
> Firstly, here is a brief example of some code that behaves very
> differently on 2.6.5 and 2.6.6:
>
> http://www.twistedmatrix.com/users/glyph/signal-bug.c
>
> I have verified that it says "Completed" on kernel 2.6.5, 2.6.3 and
> 2.6.1, and says "Died" on 2.6.6, 2.6.7 and 2.6.8.1, so I am pretty
> sure the difference is between 2.5.6 and 2.6.6.
>
FYI:
# gcc signal-bug.c -Wall -lutil -lpthread -o signal-bug; ./signal-bug
Completed.
# cat /proc/version
Linux version 2.6.8-rc2-mm1 (root@phoebee) (gcc version 3.3.3 20040412
(Gentoo Linux 3.3.3-r6, ssp-3.3.2-2, pie-8.7.6)) #1 Wed Jul 28 11:39:48
CEST 2004
--
MyExcuse:
Flat tire on station wagon with tapes. ("Never underestimate the
bandwidth of a station wagon full of tapes hurling down the highway"
Andrew S. Tannenbaum)
Martin Zwickel <martin.zwickel@technotrend.de>
Research & Development
TechnoTrend AG <http://www.technotrend.de>
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: inconsistency in thread/signal interaction in 2.6.5 and previous vs. 2.6.6 and later (possibly a bug?)
2004-08-16 10:11 ` Martin Zwickel
@ 2004-08-16 10:18 ` Paweł Sikora
0 siblings, 0 replies; 5+ messages in thread
From: Paweł Sikora @ 2004-08-16 10:18 UTC (permalink / raw)
To: Martin Zwickel; +Cc: Glyph Lefkowitz, linux-kernel
On Monday 16 of August 2004 12:11, Martin Zwickel wrote:
> On Mon, 16 Aug 2004 06:01:05 -0400
>
> Glyph Lefkowitz <glyph@divmod.com> bubbled:
> > Hello Kernel People,
> >
> > Firstly, here is a brief example of some code that behaves very
> > differently on 2.6.5 and 2.6.6:
> >
> > http://www.twistedmatrix.com/users/glyph/signal-bug.c
> >
> > I have verified that it says "Completed" on kernel 2.6.5, 2.6.3 and
> > 2.6.1, and says "Died" on 2.6.6, 2.6.7 and 2.6.8.1, so I am pretty
> > sure the difference is between 2.5.6 and 2.6.6.
>
> FYI:
> # gcc signal-bug.c -Wall -lutil -lpthread -o signal-bug; ./signal-bug
> Completed.
>
> # cat /proc/version
> Linux version 2.6.8-rc2-mm1 (root@phoebee) (gcc version 3.3.3 20040412
> (Gentoo Linux 3.3.3-r6, ssp-3.3.2-2, pie-8.7.6)) #1 Wed Jul 28 11:39:48
> CEST 2004
# gcc signal-bug.c -Wall -lpthread -lutil -o signal-bug; ./signal-bug
Died.
# cat /proc/version
Linux version 2.6.8 (pluto@vmx) (gcc version 3.4.2 20040806 (prerelease)
(PLD Linux)) #1 Sun Aug 15 19:58:30 CEST 2004
# rpm -q glibc
glibc-2.3.4-0.20040722.2+nptl
--
/* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */
#define say(x) lie(x)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: inconsistency in thread/signal interaction in 2.6.5 and previous vs. 2.6.6 and later (possibly a bug?)
2004-08-16 10:01 inconsistency in thread/signal interaction in 2.6.5 and previous vs. 2.6.6 and later (possibly a bug?) Glyph Lefkowitz
2004-08-16 10:11 ` Martin Zwickel
@ 2004-08-16 10:48 ` Jesper Juhl
2004-08-16 21:14 ` Glyph Lefkowitz
1 sibling, 1 reply; 5+ messages in thread
From: Jesper Juhl @ 2004-08-16 10:48 UTC (permalink / raw)
To: Glyph Lefkowitz; +Cc: linux-kernel
On Mon, 16 Aug 2004, Glyph Lefkowitz wrote:
> Hello Kernel People,
>
> Firstly, here is a brief example of some code that behaves very
> differently on 2.6.5 and 2.6.6:
>
> http://www.twistedmatrix.com/users/glyph/signal-bug.c
>
> I have verified that it says "Completed" on kernel 2.6.5, 2.6.3 and
> 2.6.1, and says "Died" on 2.6.6, 2.6.7 and 2.6.8.1, so I am pretty sure
> the difference is between 2.5.6 and 2.6.6.
>
FYI :
juhl@dragon:~$ gcc signal-bug.c -Wall -lutil -lpthread -o signal-bug; ./signal-bug
Completed.
juhl@dragon:~$ cat /proc/version
Linux version 2.6.8.1 (juhl@dragon) (gcc version 3.4.1) #1 Sun Aug 15 22:01:56 CEST 2004
glibc is 2.3.2
--
Jesper Juhl <juhl-lkml@dif.dk>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: inconsistency in thread/signal interaction in 2.6.5 and previous vs. 2.6.6 and later (possibly a bug?)
2004-08-16 10:48 ` Jesper Juhl
@ 2004-08-16 21:14 ` Glyph Lefkowitz
0 siblings, 0 replies; 5+ messages in thread
From: Glyph Lefkowitz @ 2004-08-16 21:14 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-kernel
On Mon, 2004-08-16 at 12:48 +0200, Jesper Juhl wrote:
> juhl@dragon:~$ gcc signal-bug.c -Wall -lutil -lpthread -o signal-bug; ./signal-bug
> Completed.
> juhl@dragon:~$ cat /proc/version
> Linux version 2.6.8.1 (juhl@dragon) (gcc version 3.4.1) #1 Sun Aug 15 22:01:56 CEST 2004
>
> glibc is 2.3.2
Thanks for the feedback. I will test with 2.6.8.1 myself, just to be
sure, but for those interested in the problem, I've included a few other
recordings of results I got on hosts with a variety of architectures and
kernel versions.
I could swear I tested this on a different host already, but I can't
find the results, so I will build a 2.6.8.1 without debian patches, just
to be sure.
glyph@trogdor:~% gcc signal-bug.c -Wall -lutil -lpthread -o signal-bug; ./signal-bug
Died.
glyph@trogdor:~% cat /proc/version
Linux version 2.6.7-1-686 (dilinger@toaster.hq.voxel.net) (gcc version 3.3.4 (Debian 1:3.3.4-2)) #1 Thu Jul 8 05:36:53 EDT 2004
glyph@trogdor:~% dpkg -l libc6 | tail -1
ii libc6 2.3.2.ds1-16 GNU C Library: Shared libraries and Timezone
glyph@kazekage:~% gcc signal-bug.c -Wall -lutil -lpthread -o signal-bug; ./signal-bug
Died.
glyph@kazekage:~% cat /proc/version
Linux version 2.6.7-1-k7 (dilinger@toaster.hq.voxel.net) (gcc version 3.3.4 (Debian 1:3.3.4-2)) #1 Thu Jul 8 06:45:35 EDT 2004
glyph@kazekage:~% dpkg -l libc6 | tail -1
ii libc6 2.3.2.ds1-16 GNU C Library: Shared libraries and Timezone
glyph@wolfwood:~$ gcc signal-bug.c -Wall -lutil -lpthread -o signal-bug; ./signal-bug
Completed.
glyph@wolfwood:~$ cat /proc/version
Linux version 2.4.25vm-1um (root@shared4.tummy.com) (gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1)) #2 Fri Feb 20 14:03:26 MST 2004
glyph@wolfwood:~$ dpkg -l libc6 | tail -1
ii libc6 2.3.1-16 GNU C Library: Shared libraries and Timezone
glyph@pyramid:~% gcc signal-bug.c -Wall -lutil -lpthread -o signal-bug; ./signal-bug
Completed.
glyph@pyramid:~% cat /proc/version
Linux version 2.4.18 (root@pyramid.twistedmatrix.com) (gcc version 2.95.4 20011002 (Debian prerelease)) #1 SMP Wed Feb 25 14:26:24 MST 2004
glyph@pyramid:~% dpkg -l libc6 | tail -1
ii libc6 2.2.5-11.5 GNU C Library: Shared libraries and Timezone
glyph@watt:~$ gcc signal-bug.c -Wall -lutil -lpthread -o signal-bug; ./signal-bug
Completed.
glyph@watt:~$ cat /proc/version
Linux version 2.4.25 (root@sparesolo20040319) (gcc version 2.95.4 20011002 (Debian prerelease)) #1 Wed Apr 7 16:22:47 MDT 2004
glyph@watt:~$ dpkg -l libc6 | tail -1
ii libc6 2.3.2.ds1-12 GNU C Library: Shared libraries and Timezone
glyph@erlang:~$ gcc signal-bug.c -Wall -lutil -lpthread -o signal-bug; ./signal-bug
Completed.
glyph@erlang:~$ cat /proc/version
Linux version 2.6.4 (root@erlang) (gcc version 3.3.3 (Debian 20040320)) #10 Mon Mar 22 20:01:54 EST 2004
glyph@erlang:~$ dpkg -l libc6 | tail -1
ii libc6 2.3.2.ds1-10 GNU C Library: Shared libraries and Timezone
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-08-16 21:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-16 10:01 inconsistency in thread/signal interaction in 2.6.5 and previous vs. 2.6.6 and later (possibly a bug?) Glyph Lefkowitz
2004-08-16 10:11 ` Martin Zwickel
2004-08-16 10:18 ` Paweł Sikora
2004-08-16 10:48 ` Jesper Juhl
2004-08-16 21:14 ` Glyph Lefkowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox