bugSystem V style init programs - Bugs: bug #56534, pidof fails to identify PID of...


bug #56534: pidof fails to identify PID of process

Submitted by:  vignesh <vigneshr>
Submitted on:  Fri 21 Jun 2019 02:22:28 PM UTC  
Votes:  1  
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  Jesse <newguy>
Open/Closed:  Closed

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 05 Jul 2019 01:04:16 AM UTC, comment #4: 

I have added a new flag for pidof (-z) which overrides the default behaviour. Normally pidof will still ignore zombie processes and processes in uninterruptable sleep states. When the "-z" flag is used, these processes will also be checked and listed.

This change will appear in sysvinit-2.96, probably toward the end of this year. The change has been committed to git in the 2.96 branch for people who want to patch their copy of pidof before then.

Thank you for reporting this issue.

Jesse <newguy>
Project MemberIn charge of this item.
Wed 03 Jul 2019 01:14:30 PM UTC, comment #3: 

Yes, the override option will be useful for who need to check the D / Z state process, along with override consider adding timeout option to exit from the hang condition.

In current situation for the running process ('D'/'Z' state) the pidof returns nothing,
which shows the program is not at all running, which may confuse whether the program is running or not.

vignesh <vigneshr>
Sat 29 Jun 2019 08:50:54 PM UTC, comment #2: 

Are you suggesting there should be an override option that forces pidof to try to stat processes in the D or Z state, even if it might hang?

Jesse <newguy>
Project MemberIn charge of this item.
Sat 29 Jun 2019 08:36:07 PM UTC, comment #1: 

Yes, that is correct. As the manual page says, any processes in "D" or "Z" states will not show up in a pidof listing:

"Zombie processes or processes in  disk  sleep  (states  Z  and  D, respectively)  are ignored, as attempts to access the stats of these will sometimes fail."

This is by design to avoid hanging the process.

Jesse <newguy>
Project MemberIn charge of this item.
Fri 21 Jun 2019 02:22:28 PM UTC, original submission:  

Hi Team,
pidof from killall5.c fails to identify pid of a given process (if the process is in 'D'/'Z' state).
If I made any process to 'D' / 'Z' state, and if i try to get the PID of the process, it doesn't shows up the PID.

D state process:
1447 pts/0    D+     0:00 python /mnt/data/t.py

when I try to get the pid, returns nothing
root@beaglebone:~$ pidof python

Nothing returned.

it seems to be related to the commit 1b659c8e

Vignesh R

vignesh <vigneshr>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by newguy (Posted a comment)
  • -email is unavailable- added by coldforest (Voted in favor of this item)
  • -email is unavailable- added by vigneshr (Submitted the item)
  • -email is unavailable- added by vigneshr

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 1 encouragement so far.

    Only logged-in users can vote.




    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-07-05 newguy StatusNeed Info => Fixed
        Open/ClosedOpen => Closed
    2019-06-29 newguy StatusNone => Need Info
        Assigned toNone => newguy
    2019-06-27 coldforest Carbon-Copy- => Added coldforest
    2019-06-21 vigneshr Carbon-Copy- => Added vignesh.r@timesys.com

    Back to the top

    Powered by Savane 3.6