Re: parent of an orphaned process

[email protected] (Mike Pomraning)
Newsgroups perl.ithreads
Message-ID <[email protected]>
On Wed, 24 Nov 2004, Madhav wrote:

> this indicates that the parent of the orphaned child process is not the
> init process as it should be. please tell me what is means. i did the
> same program in C and got the parent id as 1. cant it be the same with perl?

Looks like a bug.  Behavior hasn't always been this way, it seems.  Running
the following code snippet on a few perls I have lying around...

   $ perl -le 'pipe(R,W); fork and exit; close(W); sysread(R,$a,1); print "$]: ppid ", getppid'

...gives the following:

  5.00404: ppid 1
  5.006001: ppid 1
  5.008: ppid 1                   # RedHat's perl-5.8.0-55
  5.008: ppid 8463                # RedHat's perl-5.8.0-88.3
  5.008001: ppid 25677
  5.008003: ppid 17581
  5.008004: ppid 4311
  5.009: ppid 25618

The getppid caveat for Linux in 5.8's perlfunc certainly suggests that
threaded contortions may be to blame.  (Are you on Linux?)

I'd strongly encourage you to pursue this at http://rt.perl.org/perlbug/.

-Mike
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.