the SSLVerifyDepth applied with the default/handshaken vhost differs from
the one applicable with the finally selected vhost. [Yann Ylavic]
+ *) core: Ensure that httpd exits with an error status when the MPM fails
+ to run. [Yann Ylavic]
+
*) mod_ssl: Add SSLOCSPProxyURL to add the possibility to do all queries
to OCSP responders through a HTTP proxy. [Ruediger Pluem]
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- *) core: Ensure that httpd exits with an error status when the MPM fails
- to run.
- trunk patch: http://svn.apache.org/r1629925
- http://svn.apache.org/r1629927
- http://svn.apache.org/r1629928
- http://svn.apache.org/r1733162
- http://svn.apache.org/r1733173
- 2.4.x patch: http://home.apache.org/~ylavic/patches/httpd-2.4.x-exit_with_error_on_mpm_failure.patch
- +1: ylavic, jim, icing
-
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
[ New proposals should be added at the end of the list ]
module **mod;
const char *opt_arg;
APR_OPTIONAL_FN_TYPE(ap_signal_server) *signal_server;
+ int rc = OK;
AP_MONCONTROL(0); /* turn off profiling of startup */
apr_pool_destroy(ptemp);
- for (;;) {
+ do {
ap_main_state = AP_SQ_MS_DESTROY_CONFIG;
apr_hook_deregister_all();
apr_pool_clear(pconf);
ap_run_optional_fn_retrieve();
ap_main_state = AP_SQ_MS_RUN_MPM;
- if (ap_run_mpm(pconf, plog, ap_server_conf) != OK)
- break;
+ rc = ap_run_mpm(pconf, plog, ap_server_conf);
apr_pool_lock(pconf, 0);
- }
- apr_pool_lock(pconf, 0);
- destroy_and_exit_process(process, 0);
+ } while (rc == OK);
+
+ if (rc == DONE) {
+ rc = OK;
+ }
+ else if (rc != OK) {
+ ap_log_error(APLOG_MARK, APLOG_EMERG, 0, NULL, APLOGNO(02818)
+ "MPM run failed, exiting");
+ }
+ destroy_and_exit_process(process, rc);
- return 0; /* Termination 'ok' */
+ /* NOTREACHED */
+ return !OK;
}
#ifdef AP_USING_AUTOCONF
if (!retained->is_graceful) {
if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
mpm_state = AP_MPMQ_STOPPING;
- return DONE;
+ return !OK;
}
/* fix the generation number in the global score; we just got a new,
* cleared scoreboard
ap_log_error(APLOG_MARK, APLOG_ALERT | level_flags, 0,
(startup ? NULL : s),
"no listening sockets available, shutting down");
- return DONE;
+ return !OK;
}
if (one_process) {
ap_log_error(APLOG_MARK, APLOG_CRIT | level_flags, rv,
(startup ? NULL : s),
"could not duplicate listeners");
- return DONE;
+ return !OK;
}
all_buckets = apr_pcalloc(pconf, num_buckets * sizeof(*all_buckets));
ap_log_error(APLOG_MARK, APLOG_CRIT | level_flags, rv,
(startup ? NULL : s),
"could not open pipe-of-death");
- return DONE;
+ return !OK;
}
all_buckets[i].listeners = listen_buckets[i];
}
listen_socket_t listeners[1];
} parent_info_t;
-static char master_main();
+static int master_main();
static void spawn_child(int slot);
void ap_mpm_child_main(apr_pool_t *pconf);
static void set_signals();
ap_mpm_child_main(pconf);
/* Outta here */
- return 1;
+ return DONE;
}
else {
/* Parent process */
- char restart;
+ int rc;
is_parent_process = TRUE;
if (ap_setup_listeners(ap_server_conf) < 1) {
ap_log_error(APLOG_MARK, APLOG_ALERT, 0, s, APLOGNO(00200)
"no listening sockets available, shutting down");
- return 1;
+ return !OK;
}
ap_log_pid(pconf, ap_pid_fname);
- restart = master_main();
+ rc = master_main();
++ap_my_generation;
ap_scoreboard_image->global->running_generation = ap_my_generation;
- if (!restart) {
+ if (rc != OK) {
ap_remove_pid(pconf, ap_pid_fname);
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, APLOGNO(00201)
- "caught SIGTERM, shutting down");
- return 1;
+ "caught %s, shutting down",
+ (rc == DONE) ? "SIGTERM" : "error");
+ return rc;
}
} /* Parent process */
- return 0; /* Restart */
+ return OK; /* Restart */
}
/* Main processing of the parent process
* returns TRUE if restarting
*/
-static char master_main()
+static int master_main()
{
server_rec *s = ap_server_conf;
ap_listen_rec *lr;
if (ap_setup_listeners(ap_server_conf) < 1) {
ap_log_error(APLOG_MARK, APLOG_ALERT, 0, s, APLOGNO(00202)
"no listening sockets available, shutting down");
- return FALSE;
+ return !OK;
}
/* Allocate a shared memory block for the array of listeners */
if (rc) {
ap_log_error(APLOG_MARK, APLOG_ALERT, APR_FROM_OS_ERROR(rc), s, APLOGNO(00203)
"failure allocating shared memory, shutting down");
- return FALSE;
+ return !OK;
}
/* Store the listener sockets in the shared memory area for our children to see */
if (rc) {
ap_log_error(APLOG_MARK, APLOG_ALERT, APR_FROM_OS_ERROR(rc), s, APLOGNO(00204)
"failure creating accept mutex, shutting down");
- return FALSE;
+ return !OK;
}
parent_info->accept_mutex = ap_mpm_accept_mutex;
if (rc) {
ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc), ap_server_conf, APLOGNO(00205)
"unable to allocate shared memory for scoreboard , exiting");
- return FALSE;
+ return !OK;
}
ap_init_scoreboard(sb_mem);
if (one_process) {
ap_scoreboard_image->parent[0].pid = getpid();
ap_mpm_child_main(pconf);
- return FALSE;
+ return DONE;
}
while (!restart_pending && !shutdown_pending) {
}
DosFreeMem(parent_info);
- return restart_pending;
+ return restart_pending ? OK : DONE;
}
if (setup_listeners(s)) {
ap_log_error(APLOG_MARK, APLOG_ALERT, status, s, APLOGNO(00223)
"no listening sockets available, shutting down");
- return -1;
+ return !OK;
}
restart_pending = shutdown_pending = 0;
if (!is_graceful) {
if (ap_run_pre_mpm(s->process->pool, SB_NOT_SHARED) != OK) {
- return 1;
+ return !OK;
}
}
}
mpm_main_cleanup();
- return 1;
+ return DONE;
}
else { /* the only other way out is a restart */
/* advance to the next generation */
}
mpm_main_cleanup();
- return 0;
+ return OK;
}
static int netware_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp)
if (!retained->is_graceful) {
if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
mpm_state = AP_MPMQ_STOPPING;
- return DONE;
+ return !OK;
}
/* fix the generation number in the global score; we just got a new,
* cleared scoreboard
make_child(ap_server_conf, 0, 0);
/* NOTREACHED */
ap_assert(0);
- return DONE;
+ return !OK;
}
/* Don't thrash since num_buckets depends on the
|| ap_get_scoreboard_process(child_slot)->generation
== retained->my_generation) {
mpm_state = AP_MPMQ_STOPPING;
- return DONE;
+ return !OK;
}
else {
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ap_server_conf, APLOGNO(00166)
ap_log_error(APLOG_MARK, APLOG_ALERT | level_flags, 0,
(startup ? NULL : s),
"no listening sockets available, shutting down");
- return DONE;
+ return !OK;
}
if (one_process) {
ap_log_error(APLOG_MARK, APLOG_CRIT | level_flags, rv,
(startup ? NULL : s),
"could not duplicate listeners");
- return DONE;
+ return !OK;
}
all_buckets = apr_pcalloc(pconf, num_buckets *
sizeof(prefork_child_bucket));
ap_log_error(APLOG_MARK, APLOG_CRIT | level_flags, rv,
(startup ? NULL : s),
"could not open pipe-of-death");
- return DONE;
+ return !OK;
}
/* Initialize cross-process accept lock (safe accept needed only) */
if ((rv = SAFE_ACCEPT((apr_snprintf(id, sizeof id, "%i", i),
ap_log_error(APLOG_MARK, APLOG_CRIT | level_flags, rv,
(startup ? NULL : s),
"could not create accept mutex");
- return DONE;
+ return !OK;
}
all_buckets[i].listeners = listen_buckets[i];
}
if (ap_setup_listeners(s) < 1) {
ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_STARTUP, 0,
NULL, APLOGNO(00451) "no listening sockets available, shutting down");
- return DONE;
+ return !OK;
}
return OK;
if (!restart && ((parent_pid == my_pid) || one_process)) {
/* Set up the scoreboard. */
if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
- return DONE;
+ return !OK;
}
}
if (!retained->is_graceful) {
if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
mpm_state = AP_MPMQ_STOPPING;
- return DONE;
+ return !OK;
}
/* fix the generation number in the global score; we just got a new,
* cleared scoreboard
ap_log_error(APLOG_MARK, APLOG_ALERT | level_flags, 0,
(startup ? NULL : s),
"no listening sockets available, shutting down");
- return DONE;
+ return !OK;
}
if (one_process) {
ap_log_error(APLOG_MARK, APLOG_CRIT | level_flags, rv,
(startup ? NULL : s),
"could not duplicate listeners");
- return DONE;
+ return !OK;
}
all_buckets = apr_pcalloc(pconf, num_buckets * sizeof(*all_buckets));
ap_log_error(APLOG_MARK, APLOG_CRIT | level_flags, rv,
(startup ? NULL : s),
"could not open pipe-of-death");
- return DONE;
+ return !OK;
}
/* Initialize cross-process accept lock (safe accept needed only) */
if ((rv = SAFE_ACCEPT((apr_snprintf(id, sizeof id, "%i", i),
ap_log_error(APLOG_MARK, APLOG_CRIT | level_flags, rv,
(startup ? NULL : s),
"could not create accept mutex");
- return DONE;
+ return !OK;
}
all_buckets[i].listeners = listen_buckets[i];
}