Changes with Apache 2.0.31-dev
+
+ *) Change the pre_mpm hook to return a value, so that scoreboard
+ init errors percolate up to code that knows how to exit
+ cleanly. This required bump to the MMN. [Jeff Trawick]
+
*) Add the socket back to the conn_rec and remove the create_connection
hook. The create_connection hook had a design flaw that did not
allow creating connections based on vhost info. [Bill Stoddard]
APACHE 2.0 STATUS: -*-text-*-
-Last modified at [$Date: 2002/01/27 08:11:09 $]
+Last modified at [$Date: 2002/01/28 00:41:31 $]
Release:
platforms, and should only be used in MPMs like worker
with limited OS exposure.
- * ap_create_scoreboard() can exit the process, leaving stuff like
- mod_cgid's daemon process stranded. Either ap_create_scoreboard()
- needs to be called at a different time or the pre-mpm hook needs
- to be able to return an error code.
-
* A binbuild installation picks up the right libraries when
running apachectl because we set the appropriate environment
variable, but ab, htpasswd, etc. don't know how to pick up apr,
* 20020114 (2.0.31-dev) mod_dav changed how it asks its provider to fulfill
* a GET request
* 20020118 (2.0.31-dev) Input filtering split of blocking and mode
+ * 20020127 (2.0.31-dev) bump for pre_mpm hook change
*/
#define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
AP_DECLARE(int) ap_exists_scoreboard_image(void);
AP_DECLARE(void) ap_increment_counts(ap_sb_handle_t *sbh, request_rec *r);
-void ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e t);
+int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e t);
apr_status_t reopen_scoreboard(apr_pool_t *p, int detached);
void ap_init_scoreboard(void *shared_score);
int ap_calc_scoreboard_size(void);
* @param p Apache pool to allocate from.
* @param sb_type
* @ingroup hooks
+ * @return OK or DECLINE on success; anything else is a error
*/
-AP_DECLARE_HOOK(void, pre_mpm, (apr_pool_t *p, ap_scoreboard_e sb_type))
+AP_DECLARE_HOOK(int, pre_mpm, (apr_pool_t *p, ap_scoreboard_e sb_type))
/* for time_process_request() in http_main.c */
#define START_PREQUEST 1
if (!is_graceful) {
/* setup the scoreboard shared memory */
- ap_run_pre_mpm(pconf, SB_SHARED);
+ if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
+ return 1;
+ }
for (i = 0; i < HARD_SERVER_LIMIT; i++) {
ap_scoreboard_image->parent[i].pid = 0;
}
if (!is_graceful) {
- ap_run_pre_mpm(pconf, SB_SHARED);
+ if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
+ return 1;
+ }
}
/* Initialize the child table */
if (!is_graceful) {
apr_thread_mutex_create(&accept_mutex, APR_THREAD_MUTEX_DEFAULT, pconf);
if (!is_graceful) {
- ap_run_pre_mpm(pconf, SB_NOT_SHARED);
+ if (ap_run_pre_mpm(pconf, SB_NOT_SHARED) != OK) {
+ return 1;
+ }
}
/* Only set slot 0 since that is all NetWare will ever have. */
}
if (!is_graceful) {
- ap_run_pre_mpm(pconf, SB_SHARED);
+ if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
+ return 1;
+ }
}
/* Initialize the child table */
if (!is_graceful) {
SAFE_ACCEPT(accept_mutex_init(pconf));
if (!is_graceful) {
- ap_run_pre_mpm(pconf, SB_SHARED);
+ if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
+ return 1;
+ }
}
#ifdef SCOREBOARD_FILE
else {
if (one_process) {
/* Set up the scoreboard. */
- ap_run_pre_mpm(pconf, SB_SHARED);
+ if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
+ return 1;
+ }
if (ap_setup_listeners(ap_server_conf) < 1) {
return 1;
}
exit(1);
}
- ap_run_pre_mpm(pconf, SB_SHARED_CHILD);
+ if (ap_run_pre_mpm(pconf, SB_SHARED_CHILD) != OK) {
+ exit(1);
+ }
ap_my_generation = atoi(getenv("AP_MY_GENERATION"));
get_listeners_from_parent(ap_server_conf);
}
}
else /* Child */ {
/* Set up the scoreboard. */
- ap_run_pre_mpm(pconf, SB_SHARED);
+ if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
+ return 1;
+ }
/* Parent process */
if (ap_setup_listeners(ap_server_conf) < 1) {
}
if (!is_graceful) {
- ap_run_pre_mpm(pconf, SB_SHARED);
+ if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
+ return 1;
+ }
}
set_signals();
ap_daemons_limit);
max_clients = ap_daemons_limit * ap_threads_per_child;
}
+ /* XXX
+ * ap_daemons_limit can reach server_limit * ap_threads_per_child, right?
+ */
if (ap_daemons_limit > server_limit) {
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
"WARNING: MaxClients of %d would require %d servers,",
APR_HOOK_LINK(pre_mpm)
)
-AP_IMPLEMENT_HOOK_VOID(pre_mpm,
- (apr_pool_t *p, ap_scoreboard_e sb_type),
- (p, sb_type))
+AP_IMPLEMENT_HOOK_RUN_ALL(int,pre_mpm,
+ (apr_pool_t *p, ap_scoreboard_e sb_type),
+ (p, sb_type),OK,DECLINED)
struct ap_sb_handle_t {
int child_num;
/* Create or reinit an existing scoreboard. The MPM can control whether
* the scoreboard is shared across multiple processes or not
*/
-void ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
+int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
{
int running_gen = 0;
#if APR_HAS_SHARED_MEMORY
void *sb_shared;
rv = open_scoreboard(p);
if (rv || !(sb_shared = apr_shm_baseaddr_get(ap_scoreboard_shm))) {
- exit(APEXIT_INIT); /* XXX need to return an error from this function */
+ return HTTP_INTERNAL_SERVER_ERROR;
}
memset(sb_shared, 0, scoreboard_size);
ap_init_scoreboard(sb_shared);
void *sb_shared;
rv = reopen_scoreboard(p, 1);
if (rv || !(sb_shared = apr_shm_baseaddr_get(ap_scoreboard_shm))) {
- exit(APEXIT_INIT); /* XXX need to return an error from this function */
+ return HTTP_INTERNAL_SERVER_ERROR;
}
ap_init_scoreboard(sb_shared);
}
ap_log_error(APLOG_MARK, APLOG_CRIT | APLOG_NOERRNO, 0, NULL,
"(%d)%s: cannot allocate scoreboard",
errno, strerror(errno));
- exit(APEXIT_INIT); /* XXX need to return an error from this function */
+ return HTTP_INTERNAL_SERVER_ERROR;
}
ap_init_scoreboard(sb_mem);
}
apr_pool_cleanup_null);
}
ap_restart_time = apr_time_now();
+ return OK;
}
/* Routines called to deal with the scoreboard image