You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by David Wills <mi...@gmail.com> on 2005/08/13 13:02:03 UTC

[users@httpd] Apache2 restart issues

Hi,

I have been trying to move from prefork to worker MPM on apache 2.

I have a problem however. The compilation runs perfectly, the server
starts fine.

When I restart the daemon it doesn't finish killing all of apaches
processes before starting the service again. Because of this it fails
the restart with:

Starting httpd: (98)Address already in use: make_sock: could not bind
to address xxx.xxx.xxx.xxx:80
no listening sockets available, shutting down
Unable to open logs

That said, if I then restart it again a few seconds later it will do
so correctly. This is because all of the processes have been
terminated and apache can start again.

Any ideas what could be causing this ?

I have a very basic setup - with PHP4.4.0

Here are my PHP compilation options:

./configure --prefix=/usr/share --datadir=/usr/share/php
--with-apxs2=/usr/sbin/apxs  --with-mysql=/usr --bindir=/usr/bin
--libdir=/usr/share --includedir=/usr/include --with-_lib=lib
--with-config-file-path=/etc --with-exec-dir=/usr/lib/php/bin
--disable-debug --enable-calendar --enable-magic-quotes
--enable-track-vars --with-xml --with-curl --with-zlib-dir=yes
--with-gd --with-jpeg-dir=/usr --with-png-dir --enable-gd-native-ttf
--with-ssl

Here are my Apache compilation options:

export CFLAGS="-O2 -march=i686 -funroll-loops -D_REENTRANT
-D_SINGLE_LISTEN_UNSERIALIZED_ACCEPT -fPIC"
./configure --prefix=/etc/httpd \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--mandir=/usr/share/man \
--sysconfdir=/etc/httpd/conf \
--includedir=/usr/include/httpd \
--libexecdir=/usr/lib/httpd/modules \
--datadir=/home/httpd \
--localstatedir=/var \
--with-mpm=worker \
--enable-access=shared \
--enable-actions=shared \
--enable-alias=shared \
--enable-auth=shared \
--enable-auth-dbm=shared \
--enable-auth-digest=shared \
--enable-autoindex=shared \
--enable-cern-meta=shared \
--enable-dav=shared \
--enable-dav-fs=shared \
--enable-dir=shared \
--enable-env=shared \
--enable-expires=shared \
--enable-file-cache=shared \
--enable-headers=shared \
--enable-include=shared \
--enable-log-config=shared \
--enable-deflate \
--enable-mime=shared \
--enable-mime-magic=shared \
--enable-negotiation=shared \
--enable-rewrite=shared \
--enable-setenvif=shared \
--enable-speling=shared \
--enable-ssl=shared \
--enable-unique-id=shared \
--enable-usertrack=shared \
--enable-vhost-alias=shared \
--enable-suexec=shared \
--with-suexec-caller=www \
--with-suexec-docroot=/home/httpd \
--with-suexec-logfile=/var/log/httpd/suexec.log \
--with-suexec-bin=/usr/sbin/suexec \
--with-suexec-uidmin=500 --with-suexec-gidmin=500 \
--disable-cgi \
--disable-cgid \
--disable-auth-anon \
--disable-charset-lite \
--disable-disk-cache \
--disable-mem-cache \
--disable-cache \
--disable-ext-filter \
--disable-case-filter \
--disable-case-filter-in \
--disable-example \
--disable-proxy \
--disable-proxy-connect \
--disable-proxy-ftp \
--disable-proxy-http \
--disable-status \
--disable-asis \
--disable-info \
--disable-imap \
--disable-userdir \
--with-z \
--with-ssl \
--with-suexec

This is my httpd init script:

#!/bin/bash

# This shell script takes care of starting and stopping Apache.
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve \
#              HTML files and CGI.
#
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# pidfile: /var/run/httpd.pid

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Source for additional options if we have them.
if [ -f /etc/sysconfig/httpd ] ; then
        . /etc/sysconfig/httpd
fi

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# If Apache is not available stop now.
[ -f /usr/sbin/httpd ] || exit 0

# Path to the Apache apachectl script and server binary.
apachectl=/usr/sbin/apachectl
httpd=/usr/sbin/httpd

RETVAL=0
prog="httpd"

start() {
        echo -n $"Starting $prog: "
        daemon $httpd $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
        return $RETVAL
}

stop() {
        echo -n $"Shutting down $prog: "
        killproc $httpd
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
        return $RETVAL
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status $httpd
        RETVAL=$?
        ;;
  restart)
        stop
        start
        RETVAL=$?
        ;;
  condrestart)
        if [ -f /var/run/httpd.pid ] ; then
                stop
                start
                RETVAL=$?
        fi
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart}"
        exit 1
esac
exit $RETVAL

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache2 restart issues

Posted by Joshua Slive <js...@gmail.com>.
On 8/13/05, David Wills <mi...@gmail.com> wrote:
> Hi Joshua,
> 
> Yes I have certainly read about the issues php has with thread-safety
> however I don't think I'm using anything but the most common config
> there is. I kinda figured by now it would have worked for such a
> simple and lean config.
> 
> Is the problem I described symptomatic of a thread safety issue ?

I'm not an expert, but I would say yes, this problem very well could
be a thread safety issue.

And no, I don't believe that a basic php install is thread-safe.  The
last I heard (though it was a while ago), the php folks esentially
believed it was impossible to guarantee thread-safety in even a basic
install.  See:
http://www.php.net/manual/en/faq.installation.php#faq.installation.apache2

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache2 restart issues

Posted by David Wills <mi...@gmail.com>.
Hi Joshua,

Yes I have certainly read about the issues php has with thread-safety
however I don't think I'm using anything but the most common config
there is. I kinda figured by now it would have worked for such a
simple and lean config.

Is the problem I described symptomatic of a thread safety issue ?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache2 restart issues

Posted by Joshua Slive <js...@gmail.com>.
On 8/13/05, David Wills <mi...@gmail.com> wrote:
> I have been trying to move from prefork to worker MPM on apache 2.
> 
> I have a problem however. The compilation runs perfectly, the server
> starts fine.
> 
> When I restart the daemon it doesn't finish killing all of apaches
> processes before starting the service again. Because of this it fails
> the restart with:
> 
> Starting httpd: (98)Address already in use: make_sock: could not bind
> to address xxx.xxx.xxx.xxx:80
> no listening sockets available, shutting down
> Unable to open logs

> I have a very basic setup - with PHP4.4.0

Do you understand all the thread-safety issues with php?  Have you
verified that all your php libraries are thread-safe?  If not, you
should go back to prefork.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org