https://bz.apache.org/bugzilla/show_bug.cgi?id=59644

            Bug ID: 59644
           Summary: It is possible to have uncontrolled httpd instance
           Product: Apache httpd-2
           Version: 2.4.20
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: [email protected]
          Reporter: [email protected]

At first about the problem. If start Apache twice, it may happen that second
instance will ignore the first one:

> % sudo apachectl restart && sudo apachectl restart
> httpd not running, trying to start
> httpd not running, trying to start
> % ps -ef | grep httpd | grep -v grep
> root     28608     1  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> daemon   28613 28608  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> daemon   28614 28608  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> daemon   28615 28608  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> daemon   28616 28608  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> root     28617     1  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> daemon   28699 28617  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> daemon   28700 28617  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> daemon   28701 28617  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> daemon   28702 28617  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart

And here are the problem, one of httpd groups becomes uncontrolled by the usual
way:

> % sudo apachectl stop
> % sudo apachectl stop
> httpd (no pid file) not running
> % ps -ef | grep httpd | grep -v grep
> root     28608     1  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> daemon   28613 28608  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> daemon   28614 28608  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> daemon   28615 28608  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart
> daemon   28616 28608  0 04:58 ?        00:00:00 /usr/local/apache2/bin/httpd 
> -k restart

Second httpd instance overwrites pid file (from log: "pid file
/usr/local/apache2/logs/httpd.pid overwritten -- Unclean shutdown of previous
Apache run?") so there are no regular way to control first httpd instance.

How to reproduce. It seems httpd should be quite heavy to achieve this (with a
lot of modules). Default way (configure && make && sudo make install) works ok,
but for example using this way it reproduces for me on clean CentOS 7.1:

> % configure --enable-modules=all --enable-mods-static=all
> % make && sudo make install

Issue might sitting there for a lot of time. In 2.2 it is similar with one
conceptual difference:

> % sudo apachectl restart && sudo apachectl restart
> httpd not running, trying to start
> httpd not running, trying to start
> (98)Address already in use: make_sock: could not bind to address [::]:80
> (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
> no listening sockets available, shutting down
> Unable to open logs

That inability to bind port saves from second httpd instance. But since 2.4.17
there is unconditionally used SO_REUSEPORT on listening socket (even if feature
that it is intended for is not used), so binding of already bound port goes
without errors.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to