Bug 47778 - wrong exit value on graceful restart
Summary: wrong exit value on graceful restart
Status: REOPENED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.2.13
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-03 00:42 UTC by harald.dunkel
Modified: 2009-09-06 10:44 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description harald.dunkel 2009-09-03 00:42:56 UTC
I am running httpd on a generated httpd.conf file. If the configuration is changed while httpd is running, and then loaded using

	if httpd -f /my/httpd.conf -t; then
		httpd -f /my/httpd.conf -k graceful || exit_with_error
	fi

then the exit value of the graceful restart is 0, even though error_log says

[Thu Sep 03 09:12:26 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Sep 03 09:12:26 2009] [warn] pid file /tomcat/httpd/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Sep 03 09:12:26 2009] [notice] Apache/2.2.13 (Unix) mod_ssl/2.2.13 OpenSSL/0.9.8k configured -- resuming normal operations
[Thu Sep 03 09:12:43 2009] [notice] Graceful restart requested, doing restart
(98)Address already in use: make_sock: could not bind to address xx.xx.xx.xx:80
no listening sockets available, shutting down
Unable to open logs

The suggested workaround to check the semantics ("start httpd as non-root") doesn't work in scripts, because this _always_ fails either due to bind, or due to the attempted access to reserved port 80/tcp, or it succeeds and keeps an unwanted httpd running with the wrong uid.

I don't expect any miracles, but the exit value of "httpd -k graceful" _should_ show whether an httpd with the new configuration is running. Reliability is highly important for us. Silently dying Apaches is a _huge_ problem in our environment.
Comment 1 Eric Covener 2009-09-03 06:17:49 UTC
The httpd that's running at this point, to send the graceful restart signal, can't predict/inspect anything about the restarting httpd.  

A 0 exit code means the restart signal was sent, and checking/polling for the status of your httpd is beyond the scope of -k graceful.
Comment 2 harald.dunkel 2009-09-03 07:51:54 UTC
I Understand, but the bug is that this procedure is not reliable IRL. Running an httpd I don't want to know whether the signaling mechanism worked, but whether Apache is still alive.

I thought you would be interested in improving Apache? Can't you imagine that the restarting httpd and the running httpd perform some kind of IPC other than just a unidirectional signal?

Please reconsider.


Many thanx

Harri
Comment 3 Eric Covener 2009-09-03 08:04:48 UTC
Marking as enhancement as the exit code is reasonable, patches welcome.
Comment 4 Dan Poirier 2009-09-06 10:44:58 UTC
Looks like this was meant to be enhancement, not blocker.