LWN.net Logo

Making threads die quickly

Making threads die quickly

Posted Aug 22, 2002 9:35 UTC (Thu) by jcownie (guest, #3374)
Parent article: Making threads die quickly

Of course the real problem here is in the ptrace implementation
forcing the re-parenting of processes. That is just plain wrong,
and prevents some codes from working as expected when being debugged.

For instance consider a code which forks and whose child is
debugged. When the child process exits the debugger receives
the SIGCHLD, not the parent, and the parent therefore behaves differently
than it would if the child process were not being debugged.

Reparenting debugged processes is a "neat hack" to make the
ptrace implementation easier, but it's not really the right solution.
(And AFAIK no other unix systems behave this way).

As someone who works on debuggers, I can tell you that we've had
complaints that our product doesn't work right which are a direct
result of this ptrace hack (and which we therefore can't fix in our
debugger :-( ).


(Log in to post comments)

Making threads die quickly

Posted Aug 22, 2002 14:42 UTC (Thu) by pflugstad (subscriber, #224) [Link]

The Linux developers know it's a problem. If you read about
this discussion here:

http://kerneltrap.com/node.php?id=384

Near the end Linus says exactly the same thing you do - the ptrace
mechanism sucks.

However, at the end, Linus says:
> Ok, you've convinced me. The reparenting is fairly ugly, but it sounds
> like other implementations would be fairly equivalent and it would be
> mainly an issue of just which list we'd work on.
>
> Linus

You can read the whole thread by following the link on the
above page.

Pete

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds