Author: mturk
Date: Wed Feb 25 07:31:45 2009
New Revision: 747694

URL: http://svn.apache.org/viewvc?rev=747694&view=rev
Log:
Fix #46763. Survive the log mutex during restart.

Modified:
    tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
    tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml

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=747694&r1=747693&r2=747694&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 Wed Feb 25 07:31:45 
2009
@@ -128,6 +128,7 @@
 #define JK_MAGIC_TYPE       ("application/x-jakarta-servlet")
 #define NULL_FOR_EMPTY(x)   ((x && !strlen(x)) ? NULL : x)
 #define STRNULL_FOR_NULL(x) ((x) ? (x) : "(null)")
+#define JK_LOG_LOCK_KEY     ("jk_log_lock_key")
 /*
  * If you are not using SSL, comment out the following line. It will make
  * apache run faster.
@@ -3200,29 +3201,37 @@
     jk_server_conf_t *conf;
     server_rec *srv = s;
     const char *err_string = NULL;
+    void *data = NULL;
 
-    /* create the jk log lockfiles in the parent */
-    if ((rv = apr_global_mutex_create(&jk_log_lock, NULL,
-                                      APR_LOCK_DEFAULT,
-                                      pconf)) != APR_SUCCESS) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
-                     "mod_jk: could not create jk_log_lock");
-        return HTTP_INTERNAL_SERVER_ERROR;
-    }
+    apr_pool_userdata_get(&data, JK_LOG_LOCK_KEY, s->process->pool);
+    if (data == NULL) {
+        /* create the jk log lockfiles in the parent */
+        if ((rv = apr_global_mutex_create(&jk_log_lock, NULL,
+                                          APR_LOCK_DEFAULT,
+                                          s->process->pool)) != APR_SUCCESS) {
+            ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
+                         "mod_jk: could not create jk_log_lock");
+            return HTTP_INTERNAL_SERVER_ERROR;
+        }
 
 #if JK_NEED_SET_MUTEX_PERMS
 #if (MODULE_MAGIC_NUMBER_MAJOR >= 20090208)
-    rv = ap_unixd_set_global_mutex_perms(jk_log_lock);
+        rv = ap_unixd_set_global_mutex_perms(jk_log_lock);
 #else
-    rv = unixd_set_global_mutex_perms(jk_log_lock);
+        rv = unixd_set_global_mutex_perms(jk_log_lock);
 #endif
-    if (rv != APR_SUCCESS) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
-                     "mod_jk: Could not set permissions on "
-                     "jk_log_lock; check User and Group directives");
-        return HTTP_INTERNAL_SERVER_ERROR;
-    }
+        if (rv != APR_SUCCESS) {
+            ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
+                         "mod_jk: Could not set permissions on "
+                         "jk_log_lock; check User and Group directives");
+            return HTTP_INTERNAL_SERVER_ERROR;
+        }
 #endif
+        apr_pool_userdata_set((const void *)jk_log_lock, JK_LOG_LOCK_KEY,
+                              apr_pool_cleanup_null, s->process->pool);
+    } else {
+        jk_log_lock = (apr_global_mutex_t *)data;
+    }
 
     main_server = s;
     jk_log_fps = apr_hash_make(pconf);

Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?rev=747694&r1=747693&r2=747694&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Wed Feb 25 
07:31:45 2009
@@ -43,6 +43,10 @@
   <br />
   <subsection name="Native">
     <changelog>
+      <fix>
+        <bug>46763</bug>: Survive the log mutex during graceful
+        restart. Patch provide by Eiji Takahashi. (mturk)
+      </fix>
       <update>
       IIS: Update uriworkermap.properies file on
       a regular interval. This requires both worker_mount_reload



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to