public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* wait() and strace -f
@ 2001-12-18  1:14 Kurt Roeckx
  2001-12-18 15:32 ` OGAWA Hirofumi
       [not found] ` <877krlc60x.fsf@devron.myhome.or.jp>
  0 siblings, 2 replies; 4+ messages in thread
From: Kurt Roeckx @ 2001-12-18  1:14 UTC (permalink / raw)
  To: linux-kernel

I got a weird problem here.  I have a process that creates 2
childs, the first one dies very fast before the parent can call
wait().  When I strace -f this wait() doesn't clean up the zombie
as it should.

Note that this problem only happens when I have 2 childeren, use
strace -f, and call wait after the first child died.  Just
strace, without strace, only 1 child, or call wait() after the
child died doesn't seem to cause the problem.

Btw, this is with 2.4.16.

Simple program to demostrate it:

int     main()
{
        int     i;

        if (!fork())
        {
                /* Child 1. */
                return 0;
        }

        if (!fork())
        {
                /* Child 2. */
                sleep(10);
                return 0;
        }

        /* Parent. */
        sleep(1);
        wait(&i);
        return 0;
}

Without strace -f, this program stops after 1 second and the
second child still lives for 9 seconds.  With strace -f this
program stops after 10 second after the second child died.

I think it's related to strace being the "real" parent of the
child.  But that doesn't really explain why I need 2 childs.


Kurt


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-12-19 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-18  1:14 wait() and strace -f Kurt Roeckx
2001-12-18 15:32 ` OGAWA Hirofumi
     [not found] ` <877krlc60x.fsf@devron.myhome.or.jp>
2001-12-18 20:18   ` Kurt Roeckx
2001-12-19 15:26     ` OGAWA Hirofumi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox