Re: BUG: NTPL: waitpid() doesn't return?

Matthias Urlichs
2004-01-31T21:10:55Z

Hi,

bert hubert:
> [Matthias reports that threads forking multiple programs and running waitpid
> on them has problems]
>
To recap:

This process, on a SMP machine, does generate a few threads. Each
thread forks off some process, which it then waitpid()s for.
There is no SIGCHLD handler.

All but the last of these waitpid()s, as seen in strace output, never
return.

31342 <... clone resumed> child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x416dbc18) = 31346
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 ...>

Your test program works... except that it reports, when I strace it,

[pid 10629] waitpid(10631, Process 10629 suspended
<unfinished ...>
[pid 10628] <... mmap2 resumed> ) = 0x41966000
[pid 10630] waitpid(10632, Process 10630 suspended
<unfinished ...>

Those "Process ### suspended" messages did NOT happen with the Python
script that exhibits the bug.