Author: rjung Date: Sun Jan 6 06:38:54 2008 New Revision: 609319 URL: http://svn.apache.org/viewvc?rev=609319&view=rev Log: Move shm open to prepare automatic size detection (wee need to read the worker map before opening shm). wc_open() needs to stay behind shm, because it already uses the shm.
Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c?rev=609319&r1=609318&r2=609319&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original) +++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Sun Jan 6 06:38:54 2008 @@ -2640,6 +2640,20 @@ } } + if ((jk_worker_file != NULL) && + !jk_map_read_properties(jk_worker_properties, jk_worker_file, NULL, + JK_MAP_HANDLE_DUPLICATES, conf->log)) { + jk_error_exit(APLOG_MARK, APLOG_EMERG | APLOG_NOERRNO, s, p, + "Error in reading worker properties from '%s'", + jk_worker_file); + } + + if (jk_map_resolve_references(jk_worker_properties, "worker.", + 1, 1, conf->log) == JK_FALSE) { + jk_error_exit(APLOG_MARK, APLOG_EMERG | APLOG_NOERRNO, s, p, + "Error in resolving configuration references"); + } + #if !defined(WIN32) && !defined(NETWARE) if (!jk_shm_file) { jk_shm_file = ap_server_root_relative(p, JK_SHM_DEF_FILE); @@ -2663,20 +2677,6 @@ /* SREVILAK -- register cleanup handler to clear resources on restart, * to make sure log file gets closed in the parent process */ ap_register_cleanup(p, s, jk_server_cleanup, ap_null_cleanup); - - if ((jk_worker_file != NULL) && - !jk_map_read_properties(jk_worker_properties, jk_worker_file, NULL, - JK_MAP_HANDLE_DUPLICATES, conf->log)) { - jk_error_exit(APLOG_MARK, APLOG_EMERG | APLOG_NOERRNO, s, p, - "Error in reading worker properties from '%s'", - jk_worker_file); - } - - if (jk_map_resolve_references(jk_worker_properties, "worker.", - 1, 1, conf->log) == JK_FALSE) { - jk_error_exit(APLOG_MARK, APLOG_EMERG | APLOG_NOERRNO, s, p, - "Error in resolving configuration references"); - } /* we add the URI->WORKER MAP since workers using AJP14 will feed it */ worker_env.uri_to_worker = conf->uw_map; Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?rev=609319&r1=609318&r2=609319&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original) +++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Sun Jan 6 06:38:54 2008 @@ -2747,24 +2747,6 @@ jk_map_alloc(&jk_worker_properties); jk_map_put(jk_worker_properties, "ServerRoot", ap_server_root, NULL); -#if !defined(WIN32) && !defined(NETWARE) - if (!jk_shm_file) { - jk_shm_file = ap_server_root_relative(pconf, JK_SHM_DEF_FILE); - if (jk_shm_file) - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, - "No JkShmFile defined in httpd.conf. " - "Using default %s", jk_shm_file); - } -#endif - if ((rc = jk_shm_open(jk_shm_file, jk_shm_size, conf->log)) == 0) { - apr_pool_cleanup_register(pconf, conf->log, jk_cleanup_shmem, - jk_cleanup_shmem); - } - else - jk_log(conf->log, JK_LOG_ERROR, - "Initializing shm:%s errno=%d. Load balancing workers will not function properly.", - jk_shm_name(), rc); - /* Set default connection cache size for multi-threaded MPMs */ if (ap_mpm_query(AP_MPMQ_IS_THREADED, &is_threaded) == APR_SUCCESS && is_threaded != AP_MPMQ_NOT_SUPPORTED) { @@ -2792,6 +2774,24 @@ "Error in resolving configuration references"); return JK_FALSE; } + +#if !defined(WIN32) && !defined(NETWARE) + if (!jk_shm_file) { + jk_shm_file = ap_server_root_relative(pconf, JK_SHM_DEF_FILE); + if (jk_shm_file) + ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, + "No JkShmFile defined in httpd.conf. " + "Using default %s", jk_shm_file); + } +#endif + if ((rc = jk_shm_open(jk_shm_file, jk_shm_size, conf->log)) == 0) { + apr_pool_cleanup_register(pconf, conf->log, jk_cleanup_shmem, + jk_cleanup_shmem); + } + else + jk_log(conf->log, JK_LOG_ERROR, + "Initializing shm:%s errno=%d. Load balancing workers will not function properly.", + jk_shm_name(), rc); /* we add the URI->WORKER MAP since workers using AJP14 will feed it */ Modified: tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c?rev=609319&r1=609318&r2=609319&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c (original) +++ tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c Sun Jan 6 06:38:54 2008 @@ -1656,7 +1656,6 @@ { char shm_name[MAX_PATH]; int rc = JK_FALSE; - int rv; if (!jk_open_file_logger(&logger, log_file, log_level)) { logger = NULL; @@ -1672,14 +1671,6 @@ shm_name[i] = '_'; } } - /* - * Create named shared memory for each server - */ - if ((rv = jk_shm_open(shm_name, shm_config_size, logger)) != 0) { - jk_log(logger, JK_LOG_ERROR, - "Initializing shm:%s errno=%d. Load balancing workers will not function properly.", - jk_shm_name(), rv); - } jk_set_worker_def_cache_size(DEFAULT_WORKER_THREADS); @@ -1761,11 +1752,20 @@ if (jk_map_alloc(&workers_map)) { if (jk_map_read_properties(workers_map, worker_file, NULL, JK_MAP_HANDLE_DUPLICATES, logger)) { + int rv; + /* we add the URI->WORKER MAP since workers using AJP14 will feed it */ if (jk_map_resolve_references(workers_map, "worker.", 1, 1, logger) == JK_FALSE) { jk_log(logger, JK_LOG_ERROR, "Error in resolving configuration references"); } + /* + * Create named shared memory for each server + */ + if ((rv = jk_shm_open(shm_name, shm_config_size, logger)) != 0) + jk_log(logger, JK_LOG_ERROR, + "Initializing shm:%s errno=%d. Load balancing workers will not function properly.", + jk_shm_name(), rv); worker_env.uri_to_worker = uw_map; worker_env.server_name = serverName; @@ -1774,10 +1774,9 @@ rc = JK_TRUE; } } - else { + else jk_log(logger, JK_LOG_EMERG, "Unable to read worker file %s.", worker_file); - } if (rc != JK_TRUE) { jk_map_free(&workers_map); workers_map = NULL; Modified: tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c?rev=609319&r1=609318&r2=609319&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c (original) +++ tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c Sun Jan 6 06:38:54 2008 @@ -233,7 +233,6 @@ char *reject_unsafe = pblock_findval(REJECT_UNSAFE_TAG, pb); int rc = REQ_ABORTED; - int rv; if (!worker_prp_file) { worker_prp_file = JK_WORKER_FILE_DEF; @@ -269,14 +268,10 @@ logger = NULL; } - if ((rv = jk_shm_open(shm_file, JK_SHM_DEF_SIZE, logger)) != 0) { - jk_log(logger, JK_LOG_ERROR, - "Initializing shm:%s errno=%d. Load balancing workers will not function properly.", - jk_shm_name(), rv); - } if (jk_map_alloc(&init_map)) { if (jk_map_read_properties(init_map, worker_prp_file, NULL, JK_MAP_HANDLE_DUPLICATES, logger)) { + int rv; int sleep_cnt; SYS_THREAD s; @@ -286,6 +281,11 @@ if (reject_unsafe) { jk_map_add(init_map, "worker." REJECT_UNSAFE_TAG, reject_unsafe); + } + if ((rv = jk_shm_open(shm_file, JK_SHM_DEF_SIZE, logger)) != 0) { + jk_log(logger, JK_LOG_ERROR, + "Initializing shm:%s errno=%d. Load balancing workers will not function properly.", + jk_shm_name(), rv); } s = systhread_start(SYSTHREAD_DEFAULT_PRIORITY, 0, init_workers_on_other_threads, init_map); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]