Bug 89942 - 2nd+ forked processes only show up in ps as threads
2nd+ forked processes only show up in ps as threads
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: procps (Show other bugs)
8.0
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Alexander Larsson
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-04-29 23:04 EDT by Charles Churchill II
Modified: 2007-04-18 12:53 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-04-30 04:23:00 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Charles Churchill II 2003-04-29 23:04:43 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312

Description of problem:
If an application forks more than once, the processes beginning with the  seconf
fork and on will not show up in the ps -ef  output. They do show up in the ps
-efm output. Specifying ps -p $pid_num will also display the correct
information. The proc filesystem DOES have the correct information for the
missing processes.

The following program can be used to reprod

Version-Release number of selected component (if applicable):
procps-2.0.7

How reproducible:
Always

Steps to Reproduce:
1. Compile the following program. gcc -o pid_test pid_test.c

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>


int main()
{
  pid_t pid;

  pid = fork();
  if(pid == 0)
    {
      sleep(10000);
      exit(0);
    }

  printf("Child1 pid == %d\n",pid);

  pid = fork();
  if(pid != 0)
    {
      printf("Child2 pid == %d\n", pid);
    }

  sleep(10000);

  return 0;

}

2. Run the program: ./pid_test

3. ps -ef | grep pid_test





Actual Results:  You will only see listing for two instances of pid_test.

run the following command: ps -efm | grep pid_test
and you will see all three processes.

Expected Results:  all three processes should be listed. The fork call should
not prodice a light-weight process.

Additional info:
Comment 1 Alexander Larsson 2003-04-30 04:23:00 EDT
This is due to the way "threads" are detected in ps. Basically it just looks for
children with the exact same VMSIZE as the parent. If the child does any real
work it will typically not show up like this.

This is fixed in RHL 9 with then new threading model (NPTL).

Note You need to log in before you can comment on or make changes to this bug.