[Pkg-sysvinit-devel] Bug#719273: Acknowledgement (sysvinit-utils: /bin/pidof fails when there are stuck NFS mount points, preventing shutdown)

Daniel Povey dpovey at gmail.com
Sat Aug 10 21:11:06 UTC 2013


I am sending a patch to the source of "killall5" that I am using
locally.  It basically ignores all processes in a "D" or "Z" state (or
states where D or Z appear in the string).  This is of course not
ideal, but it works for me.  I found that not all machines where I had
stuck processes, would cause problems for start-stop-daemon-- this
patch is only for "pidof".  I may later replicate the problem with
start-stop-daemon and figure out a fix.


root at a04:~# diff -c sysvinit-2.88dsf/src/killall5.c
sysvinit-2.88dsf-modified/src/killall5.c
*** sysvinit-2.88dsf/src/killall5.c     Sat Aug 10 17:05:31 2013
--- sysvinit-2.88dsf-modified/src/killall5.c    Sat Aug 10 16:50:27 2013
***************
*** 1,5 ****
  /*
!  * kilall5.c  Kill all processes except processes that have the
   *            same session id, so that the shell that called us
   *            won't be killed. Typically used in shutdown scripts.
   *
--- 1,5 ----
  /*
!  * killall5.c Kill all processes except processes that have the
   *            same session id, so that the shell that called us
   *            won't be killed. Typically used in shutdown scripts.
   *
***************
*** 536,548 ****
                        p->statname = (char *)xmalloc(strlen(s)+1);
                        strcpy(p->statname, s);

                        /* Get session, startcode, endcode. */
                        startcode = endcode = 0;
!                       if (sscanf(q,   "%*c %*d %*d %d %*d %*d %*u %*u "
                                        "%*u %*u %*u %*u %*u %*d %*d "
                                        "%*d %*d %*d %*d %*u %*u %*d "
                                        "%*u %lu %lu",
!                                       &p->sid, &startcode, &endcode) != 3) {
                                p->sid = 0;
                                nsyslog(LOG_ERR, "can't read sid from %s\n",
                                        path);
--- 536,550 ----
                        p->statname = (char *)xmalloc(strlen(s)+1);
                        strcpy(p->statname, s);

+                       char status[11];
+
                        /* Get session, startcode, endcode. */
                        startcode = endcode = 0;
!                       if (sscanf(q,   "%10s %*d %*d %d %*d %*d %*u %*u "
                                        "%*u %*u %*u %*u %*u %*d %*d "
                                        "%*d %*d %*d %*d %*u %*u %*d "
                                        "%*u %lu %lu",
!                                       status, &p->sid, &startcode,
&endcode) != 4) {
                                p->sid = 0;
                                nsyslog(LOG_ERR, "can't read sid from %s\n",
                                        path);
***************
*** 555,560 ****
--- 557,571 ----
                        if (startcode == 0 && endcode == 0)
                                p->kernel = 1;
                        fclose(fp);
+                       if (strchr(status, 'D') != NULL ||
strchr(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;
+                       }
                } else {
                        /* Process disappeared.. */
                        if (p->argv0) free(p->argv0);




On Fri, Aug 9, 2013 at 7:33 PM, Debian Bug Tracking System
<owner at bugs.debian.org> wrote:
> Thank you for filing a new Bug report with Debian.
>
> This is an automatically generated reply to let you know your message
> has been received.
>
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
>
> Your message has been sent to the package maintainer(s):
>  Debian sysvinit maintainers <pkg-sysvinit-devel at lists.alioth.debian.org>
>
> If you wish to submit further information on this problem, please
> send it to 719273 at bugs.debian.org.
>
> Please do not send mail to owner at bugs.debian.org unless you wish
> to report a problem with the Bug-tracking system.
>
> --
> 719273: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=719273
> Debian Bug Tracking System
> Contact owner at bugs.debian.org with problems



More information about the Pkg-sysvinit-devel mailing list