From: "Matthias Urlichs" <smurf@smurf.noris.de>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: BUG: NTPL: waitpid() doesn't return?
Date: Sat, 31 Jan 2004 21:00:50 +0100 [thread overview]
Message-ID: <20040131200050.GA2160@kiste> (raw)
In-Reply-To: <Pine.LNX.4.58.0401311052180.2105@home.osdl.org>
Hi,
Linus Torvalds:
>
> "Clearly" is not correct. What I bet happens is:
>
> > 31346 execve("/usr/bin/apt-ftparchive", ["apt-ftparchive", "packages", "testing/all"], [/* 12 vars */] <unfinished ...>
> > 31346 <... execve resumed> ) = 0
> > 31346 exit_group(0) = ?
> > 31340 --- SIGCHLD (Child exited) @ 0 (0) ---
> > 31342 waitpid(31346, <unfinished ...>
>
> Notice how you do "waitpid()" for a _specific_ thread when you get a
> SIGCHLD.
>
> How the heck do you know _which_ thread it was that exited?
Please look again. The above trace clearly shows that #31346 has
exited, which is exactly the thread being waitpid()ed for.
What the program does is basically
- spawn four threads or so
- each thread forks off some process, and then waitpid()s for exactly
that pid
... and all but the last waitpid() never returns even though all four
child processes have exit_group()ed.
> Rule: never EVER wait for a specific thread in a SIGCHLD handler. When you
> get a SIGCHLD, your signal handler should just wait for "any thread".
No SIGCHLD has been installed. (I checked the strace output.)
--
Matthias Urlichs | noris network AG | http://smurf.noris.de/
next prev parent reply other threads:[~2004-01-31 20:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-31 10:46 BUG: NTPL: waitpid() doesn't return? Matthias Urlichs
2004-01-31 15:37 ` bert hubert
2004-01-31 15:51 ` Matthias Urlichs
2004-01-31 16:18 ` bert hubert
2004-01-31 18:15 ` Matthias Urlichs
2004-01-31 19:19 ` bert hubert
2004-01-31 20:49 ` Matthias Urlichs
2004-01-31 21:18 ` bert hubert
2004-01-31 21:41 ` Matthias Urlichs
2004-01-31 21:52 ` Roland McGrath
2004-01-31 19:02 ` Linus Torvalds
2004-01-31 20:00 ` Matthias Urlichs [this message]
2004-01-31 20:58 ` Linus Torvalds
2004-01-31 21:11 ` Matthias Urlichs
2004-01-31 22:52 ` Linus Torvalds
2004-01-31 22:29 ` Matthias Urlichs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040131200050.GA2160@kiste \
--to=smurf@smurf.noris.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox