public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 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

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