Bug#926896: sysvinit-utils: pidof is unreliable

Jesse Smith jsmith at resonatingmedia.com
Wed Oct 23 14:40:08 BST 2019

On 10/22/19 11:07 PM, Hoyer, David wrote:
> We have also been experiencing this problem since moving to Buster.   We never saw this with Jessie.   I believe it comes down to the following code in readproc:
>                         if ( (strchr(process_status, 'D') != NULL) ||
>                              (strchr(process_status, 'Z') != NULL) ){
>                            /* Ignore zombie processes or processes in
>                               disk sleep, as attempts
>                               to access the stats of these will
>                               sometimes fail. */
>                               if (p->argv0) free(p->argv0);
>                               if (p->argv1) free(p->argv1);
>                               if (p->statname) free(p->statname);
>                              free(p);
>                              continue;
>                         }
> Our scenario is similar although not with the same process that is described below.    It seems like this makes pidof not as effective for finding the pid of a process if D states are skipped.   Are there alternatives to pidof?   (BTW the -z option does not appear to help since this code snippet will remove it from the process list).

This seems odd to me because, prior to Buster, pidof would _always_ skip
processes in the zombie or sleeping (Z or D) states. The -z flag was
introduced to allow it to not skip them. So everything else being equal,
I'd expect to see the same number of gaps, or more gaps in the output on
older releases. Unless the process being watched (acupsd in this case)
is doing a lot more uninterruptable sleeping.

More information about the Debian-init-diversity mailing list