Bug 508701 - "ps -e" does not show nscd (but "ps ax" does)
Summary: "ps -e" does not show nscd (but "ps ax" does)
Keywords:
Status: CLOSED DUPLICATE of bug 490010
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: glibc
Version: 5.3
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Andreas Schwab
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-06-29 14:38 UTC by Matteo Corti
Modified: 2016-11-24 15:39 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-02-02 17:03:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Matteo Corti 2009-06-29 14:38:04 UTC
Description of problem:

ps -e -o comm or (ps axo comm) are not showing all the processes

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

procps-3.2.7-11.1.el5

How reproducible:

Always. Start nscd and search for it with ps -e -o comm: the process is not listed (although running).
The very same works without any problem on Fedora

Steps to Reproduce:
1. start nscd (service nscd start)
2. check that nscd is running using BSD syntax (ps ax | grep nscd)
3. check that nscd is running using standard syntac (ps -e | grep nscd)
  
Actual results:

$ ps -e | grep nscd
$ 

Expected results:

$ ps -e | grep nscd
14175 ?        00:00:03 nscd
$

Additional info:

The same command works without problems on Fedora (F11, procps-3.2.7-27.fc11.i586)

Comment 1 Matteo Corti 2009-06-30 14:17:37 UTC
After further investigation I found out that the entry in /proc for ntsc is strange:

RH5 $ cat /proc/PID/stat

28793 (exe) S 1 28793 28793 0 -1 4202816 2918 0 0 0 22 253 0 0 15 0 7 0 37808079 115728384 798 4294967295 7360512 7463540 3214996912 3214995252 4903938 0 0 3674112 16391 4294967295 0 0 17 1 0 0 0

tcomm is exe instead of nscd
/proc/PID/exe is a link to /usr/sbin/nscd

ps reads 'exe' and lists exe with the 'comm' argument

This does not happen on Fedora:

F11 $ cat /proc/PID/stat

14175 (nscd) S 1 14175 14175 0 -1 4194624 37521 0 5 0 467 1853 0 0 20 0 12 0 1878751 153812992 310 4294967295 1843200 1977488 3219997600 3219991756 6214692 0 0 3674112 16390 4294967295 0 0 17 0 0 0 0 0 0

Here tcomm corresponds to 'nscd'

Now: ist this a bug of ps that when exe is encountered should follow /proc/PID/exe or is it a kernel problem and 'exe' in tcomm field is wrong?

Comment 2 Albert Cahalan 2009-06-30 19:10:05 UTC
It's possible that nscd called prctl to change the name to exe.
Use strace to find out.

If not, this appears to be a kernel bug.

Comment 3 Matteo Corti 2009-07-07 05:41:08 UTC
Ok figured out, it is an nscd problem. nscd does:

  execv ("/proc/self/exe", argv);

which changes the name to exe

This does not occur on Fedora as there nscd tries to read the symlink and use the real name:

  /* Try to exec the real nscd program so the process name (as reported
     in /proc/PID/status) will be 'nscd', but fall back to /proc/self/exe
     if readlink fails */
  ssize_t n = readlink ("/proc/self/exe", pathbuf, sizeof (pathbuf) - 1);
  if (n == -1)
    execv ("/proc/self/exe", argv);
  else
    {
      pathbuf[n] = '\0';
      execv (pathbuf, argv);
    }

Thanks

Comment 4 Subhendu Ghosh 2009-10-23 16:44:14 UTC
Thanks for the update.
Moving to glibc component as nscd is part of glibc


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