www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Lack <gml4...@ggr.co.uk>
Subject general/4686: Apache can fail to start because it (erroneously) thinks it is alreayd running
Date Fri, 02 Jul 1999 13:58:16 GMT

>Number:         4686
>Category:       general
>Synopsis:       Apache can fail to start because it (erroneously) thinks it is alreayd
running
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Fri Jul  2 07:00:00 PDT 1999
>Last-Modified:
>Originator:     gml4410@ggr.co.uk
>Organization:
apache
>Release:        
>Environment:
SunOS4.1, Irix5.x, Irix6.x and Solaris2.x

Apapche 1.3.6
>Description:
   System crached and rebooted.

   After reboot Apache was not running.  Ran "apachectl start" but it calimed Apache *was*
running, 
so would not start it up.


   The problem is caused by apachectl checking whether the pid in httpd.pid is 
running (with kill -p $pid) but *not* whether it was running Apache.
   Processes will end up with different pids at each reboot, and the asynchronous
nature of multi-user/multi-process systems means that even process startup order
will be slightly different (allowing for sub-processses).

   What had happend is that the xdm process had managed to get started with the 
pid that had been used by Apache last time around.  This had not been cleared up
because of the crash.

   
>How-To-Repeat:
   Stop Apache.

   Edit the pid of a runnign process into the http.pid file.

   run "apachectl start"
>Fix:
   You could try the following, though I can't check the test for which ps to use
on *all* system for which Apache uses apachctl, the following works on SunOS4.x, 
Solaris2.6, Irix6.5 HP-UX-10.20 and OSF1 v3.2 (the latter two having some BSD
compatibility built into an otherwise SYSV-type ps).

Change this line:

        if [ ! "x$PID" = "x" ] && kill -0 $PID; then

to:

# Assume "SYSV" ps if "ps -f" works, else assume "BSD"
      if ps -f >/dev/null 2>&1; then
         opts='-lp '    # Trailing space. 'l' avoids any command options
      else
         opts='-c'      # No space
      fi
      what=`ps $opts$PID | awk 'NR == 2 {print $NF}'`
      if [ $what != httpd ]; then

   
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <apbugs@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or      ]
["Re: general/1098:").  If the subject doesn't match this       ]
[pattern, your message will be misfiled and ignored.  The       ]
["apbugs" address is not added to the Cc line of messages from  ]
[the database automatically because of the potential for mail   ]
[loops.  If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request from a  ]
[developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]




Mime
View raw message