You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Stas Bekman <st...@stason.org> on 2001/10/23 06:17:20 UTC

apachectl reports 'httpd started' when httpd didn't

running a freshly installed from httpd-2.0 cvs httpd:

% bin/apachectl start
bin/apachectl start: httpd started

% tail -f logs/error_log
[Tue Oct 23 12:07:26 2001] [notice] Digest: generating secret for digest 
authentication ...
[Tue Oct 23 12:07:28 2001] [notice] Digest: done
[Tue Oct 23 12:07:29 2001] [crit] (13)Permission denied: make_sock: 
could not bind to address 0.0.0.0:80
[Tue Oct 23 12:07:29 2001] [alert] no listening sockets available, 
shutting down

So httpd didn't start, while bin/apachectl reports that it did.

Either httpd returns a wrong status here (too early?):

	if $HTTPD ; then
	    echo "$0 $ARG: httpd started"

or may be an additional check for pid file should be done and report 
success/failure only then?

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Re: apachectl reports 'httpd started' when httpd didn't

Posted by Stas Bekman <st...@stason.org>.
Sander Temme wrote:

> on 10/22/01 9:17 PM, Stas Bekman at stas@stason.org wrote:
> 
> 
>>Either httpd returns a wrong status here (too early?):
>>
>>if $HTTPD ; then
>>   echo "$0 $ARG: httpd started"
>>
>>or may be an additional check for pid file should be done and report
>>success/failure only then?
>>
> 
> Apachectl basically never looks back. I posted a small patch a while ago
> that waits for a couple of seconds after starting httpd and then checks the
> presence of the pid file, but it wasn't picked up.


In fact the problem happens with 'apachectl restart' too. I use:

   apachectl stop; sleep 3; apachectl start;
instead. I do this since 'apachectl restart' reports restarted when it 
didn't, because the stop wasn't fast enough. This usually happens when 
the server is not stopping very fast (dynamic processes).

I wish apachectl was more useful. Or at least won't report things it's 
not sure about.

In the perl test framework (Apache::Test) used by httpd-2.0 test suite 
we ping the server (by fetching a static page or simply /) before 
reporting that it has started and keep on pinging for a few seconds 
until ping responds or the failure is reported. I don't see why this 
approach cannot be applied to apachectl.

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Re: apachectl reports 'httpd started' when httpd didn't

Posted by Dirk-Willem van Gulik <di...@covalent.net>.
On Mon, 22 Oct 2001, Sander Temme wrote:

> on 10/22/01 9:17 PM, Stas Bekman at stas@stason.org wrote:
>
> > Either httpd returns a wrong status here (too early?):
> >
> > if $HTTPD ; then
> >    echo "$0 $ARG: httpd started"
> >
> > or may be an additional check for pid file should be done and report
> > success/failure only then?
>
> Apachectl basically never looks back. I posted a small patch a while ago
> that waits for a couple of seconds after starting httpd and then checks the
> presence of the pid file, but it wasn't picked up.

Right now we detach() (main/httpd_main.c) far before any of the usual
errors are about to occur which will inhibit apache from running (i.e.
DocumentRoot not found, Cannot bind to port 80, etc).

It would not be too hard to shuffle things around a little -or- to
actually do(or test for) the things which commonly inhibit startup earlier
- and allow apache to give a sensible exit code. It might even make sense
to allow some early hooks during this phase - to make interactive stuff -
such as asking for an SSL password less hacky.

Dw


Re: apachectl reports 'httpd started' when httpd didn't

Posted by Sander Temme <sc...@covalent.net>.
on 10/22/01 9:17 PM, Stas Bekman at stas@stason.org wrote:

> Either httpd returns a wrong status here (too early?):
> 
> if $HTTPD ; then
>    echo "$0 $ARG: httpd started"
> 
> or may be an additional check for pid file should be done and report
> success/failure only then?

Apachectl basically never looks back. I posted a small patch a while ago
that waits for a couple of seconds after starting httpd and then checks the
presence of the pid file, but it wasn't picked up.

S.

-- 
Covalent Technologies                             sctemme@covalent.net
Engineering group                                Voice: (415) 536 5214
645 Howard St.                                     Fax: (415) 536 5210
San Francisco CA 94105

   PGP Fingerprint: 1E74 4E58 DFAC 2CF5 6A03  5531 AFB1 96AF B584 0AB1

=======================================================
This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message
=======================================================