related state has to be re-initialized to the default values
at pre-config time, but that was handled inconsistently by
the MPMs, resulting in unexpected behavior when some of the
directives were removed across restart
move that necessary initialization from the MPMs to common
code run from core's pre-config; MPMs that need to override
defaults can do so by running after core's pre-config (the
NetWare MPM now does that)
the DEFAULT_MAX_REQUESTS_PER_CHILD compile setting wasn't useful
enough to keep
the simple MPM wasn't consistent in which of these directives
were respected and which weren't, and that hasn't changed
(see procmgr.max_requests_per_child vs. ap_max_requests_per_child)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@
1086293 13f79535-47bb-0310-9956-
ffa450edef68
*/
#define AP_ACCEPT_MUTEX_TYPE "mpm-accept"
+/* internal pre-config logic for MPM-related settings, callable only from
+ * core's pre-config hook
+ */
+void mpm_common_pre_config(apr_pool_t *pconf);
+
#ifdef __cplusplus
}
#endif
apr_pool_cleanup_register(pconf, NULL, reset_config_defines,
apr_pool_cleanup_null);
+ mpm_common_pre_config(pconf);
+
return APR_SUCCESS;
}
ap_daemons_limit = server_limit;
threads_per_child = DEFAULT_THREADS_PER_CHILD;
max_clients = ap_daemons_limit * threads_per_child;
- ap_pid_fname = DEFAULT_PIDLOG;
- ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
ap_extended_status = 0;
- ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-
- apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
return OK;
}
#define DEFAULT_THREADS_PER_CHILD 25
#endif
-/* Number of requests to try to handle in a single process. If <= 0,
- * the children don't die off.
- */
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
#endif /* AP_MPM_DEFAULT_H */
/** @} */
#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000
#endif
-/* Number of requests to try to handle in a single process. If <= 0,
- * the children don't die off.
- */
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
#endif /* AP_MPM_DEFAULT_H */
/** @} */
ap_listen_pre_config();
ap_daemons_to_start = DEFAULT_START_DAEMON;
ap_thread_limit = HARD_THREAD_LIMIT;
- ap_pid_fname = DEFAULT_PIDLOG;
- ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
ap_extended_status = 0;
ap_min_spare_threads = DEFAULT_MIN_SPARE_THREAD;
ap_max_spare_threads = DEFAULT_MAX_SPARE_THREAD;
-#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
- ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-#endif
ap_sys_privileges_handlers(1);
return OK;
#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000
#endif
-/* Number of requests to try to handle in a single process. If <= 0,
- * the children don't die off.
- */
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
/* Default stack size allocated for each worker thread.
*/
#ifndef DEFAULT_THREAD_STACKSIZE
ap_threads_min_free = DEFAULT_MIN_FREE_THREADS;
ap_threads_max_free = DEFAULT_MAX_FREE_THREADS;
ap_threads_limit = HARD_THREAD_LIMIT;
- ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
ap_extended_status = 0;
+
+ /* override core's default thread stacksize */
ap_thread_stacksize = DEFAULT_THREAD_STACKSIZE;
-#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
- ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-#endif
return OK;
}
static void netware_mpm_hooks(apr_pool_t *p)
{
- ap_hook_pre_config(netware_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
+ /* Run the pre-config hook after core's so that it can override the
+ * default setting of ThreadStackSize for NetWare.
+ */
+ static const char * const predecessors[] = {"core.c", NULL};
+
+ ap_hook_pre_config(netware_pre_config, predecessors, NULL, APR_HOOK_MIDDLE);
ap_hook_check_config(netware_check_config, NULL, NULL, APR_HOOK_MIDDLE);
//ap_hook_post_config(netware_post_config, NULL, NULL, 0);
//ap_hook_child_init(netware_child_init, NULL, NULL, APR_HOOK_MIDDLE);
#define DEFAULT_MIN_FREE_DAEMON 5
#endif
-/* Number of requests to try to handle in a single process. If <= 0,
- * the children don't die off.
- */
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
#endif /* AP_MPM_DEFAULT_H */
/** @} */
ap_daemons_max_free = DEFAULT_MAX_FREE_DAEMON;
server_limit = DEFAULT_SERVER_LIMIT;
ap_daemons_limit = server_limit;
- ap_pid_fname = DEFAULT_PIDLOG;
- ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
ap_extended_status = 0;
- ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-
- apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
return OK;
}
static simple_core_t *g_simple_core;
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
-
APLOG_USE_MODULE(mpm_simple);
simple_core_t *simple_core_get()
sc->mpm_state = AP_MPMQ_STARTING;
sc->procmgr.proc_count = SIMPLE_DEF_PROC;
sc->procmgr.thread_count = SIMPLE_DEF_THREADS;
- sc->procmgr.max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
+ sc->procmgr.max_requests_per_child = 0; /* unlimited */
sc->children = apr_hash_make(sc->pool);
/* TODO: configurable spawning mech */
*/
#define HARD_SERVER_LIMIT 1
-/* Number of requests to try to handle in a single process. If <= 0,
- * the children don't die off.
- */
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
#endif /* AP_MPM_DEFAULT_H */
/** @} */
ap_listen_pre_config();
thread_limit = DEFAULT_THREAD_LIMIT;
ap_threads_per_child = DEFAULT_THREADS_PER_CHILD;
- ap_pid_fname = DEFAULT_PIDLOG;
- ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
- ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-
- apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
return OK;
}
#define DEFAULT_THREADS_PER_CHILD 25
#endif
-/* Number of requests to try to handle in a single process. If <= 0,
- * the children don't die off.
- */
-#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
-#endif
-
#endif /* AP_MPM_DEFAULT_H */
/** @} */
ap_daemons_limit = server_limit;
threads_per_child = DEFAULT_THREADS_PER_CHILD;
max_clients = ap_daemons_limit * threads_per_child;
- ap_pid_fname = DEFAULT_PIDLOG;
- ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
ap_extended_status = 0;
- ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-
- apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
return OK;
}
(void),
(), NULL)
+/* variables representing config directives implemented here */
+const char *ap_pid_fname;
+int ap_max_requests_per_child;
+char ap_coredump_dir[MAX_STRING_LEN];
+int ap_coredumpdir_configured;
+int ap_graceful_shutdown_timeout;
+apr_uint32_t ap_max_mem_free;
+apr_size_t ap_thread_stacksize;
+
+/* Set defaults for config directives implemented here. This is
+ * called from core's pre-config hook, so MPMs which need to override
+ * one of these should run their pre-config hook after that of core.
+ */
+void mpm_common_pre_config(apr_pool_t *pconf)
+{
+ ap_pid_fname = DEFAULT_PIDLOG;
+ ap_max_requests_per_child = 0; /* unlimited */
+ apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
+ ap_coredumpdir_configured = 0;
+ ap_graceful_shutdown_timeout = 0; /* unlimited */
+ ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
+ ap_thread_stacksize = 0; /* use system default */
+}
+
/* number of calls to wait_or_timeout between writable probes */
#ifndef INTERVAL_OF_WRITABLE_PROBES
#define INTERVAL_OF_WRITABLE_PROBES 10
#endif /* def HAVE_INITGROUPS */
/* standard mpm configuration handling */
-const char *ap_pid_fname = NULL;
const char *ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy,
const char *arg)
return NULL;
}
-int ap_max_requests_per_child = 0;
-
const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy,
const char *arg)
{
return NULL;
}
-char ap_coredump_dir[MAX_STRING_LEN];
-int ap_coredumpdir_configured;
-
const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
const char *arg)
{
return NULL;
}
-int ap_graceful_shutdown_timeout = 0;
-
const char * ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy,
const char *arg)
{
return NULL;
}
-apr_uint32_t ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-
const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy,
const char *arg)
{
return NULL;
}
-apr_size_t ap_thread_stacksize = 0; /* use system default */
-
const char *ap_mpm_set_thread_stacksize(cmd_parms *cmd, void *dummy,
const char *arg)
{