Here's my fix to this problem, which is to:
   o  try kill -0 10 times
   o  try kill -9 10 times
   o  give up & exit the loop

The diff follows.

Jay Ford
______________________________________________________________________

*** bind9.orig  2011-04-20 14:23:40.000000000 -0500
--- bind9       2011-05-12 21:28:05.267465164 -0500
***************
*** 13,18 ****
--- 13,20 ----
  #        which translates ip addresses to and from internet names
  ### END INIT INFO
  
+ # - fixed misguided "waiting for pid $pid to die" loop to not be infinite 
(jnford, May 12, 2011)
+ 
  PATH=/sbin:/bin:/usr/sbin:/usr/bin
  
  # for a chrooted server: "-u bind -t /var/lib/named"
***************
*** 89,97 ****
                    --pidfile ${PIDFILE} -- $OPTIONS
        fi
        if [ -n $pid ]; then
!         while kill -0 $pid 2>/dev/null; do
!           log_progress_msg "waiting for pid $pid to die"
            sleep 1
          done
        fi
        log_end_msg 0
--- 91,110 ----
                    --pidfile ${PIDFILE} -- $OPTIONS
        fi
        if [ -n $pid ]; then
!           sig=0
!           n=1
!         while kill -$sig $pid 2>/dev/null; do
!             if [ $n -eq 11 ]; then
!                echo "giving up on pid $pid with kill -0; trying -9"
!                sig=9
!             fi
!             if [ $n -gt 20 ]; then
!                echo "giving up on pid $pid"
!                break
!             fi
!           echo "waiting for pid $pid to die"
            sleep 1
+             n=$(($n+1))
          done
        fi
        log_end_msg 0



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to