tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r580798 - in /tomcat/connectors/trunk/jk/native: apache-1.3/mod_jk.c apache-2.0/mod_jk.c
Date Sun, 30 Sep 2007 21:51:30 GMT
Author: rjung
Date: Sun Sep 30 14:51:29 2007
New Revision: 580798

URL: http://svn.apache.org/viewvc?rev=580798&view=rev
Log:
Don't double init or destroy per server config.
Use was_initialized in a consistent way for
apache httpd 1.3 and 2.x.
Move logger open inside the double init check.

Modified:
    tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
    tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.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=580798&r1=580797&r2=580798&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 Sep 30 14:51:29 2007
@@ -138,6 +138,8 @@
 
     jk_uri_worker_map_t *uw_map;
 
+    int was_initialized;
+
     /*
      * Automatic context path apache alias
      */
@@ -2187,6 +2189,7 @@
     c->format = NULL;
     c->mountcopy = JK_FALSE;
     c->exclude_options = 0;
+    c->was_initialized = JK_FALSE;
 
     if (s->is_virtual) {
         c->mount_file_reload = JK_UNSET;
@@ -2483,8 +2486,9 @@
     for (; srv; srv = srv->next) {
         jk_server_conf_t *sconf = (jk_server_conf_t *)ap_get_module_config(srv->module_config,
                                                                            &jk_module);
-        open_jk_log(srv, p);
-        if (sconf) {
+        if (sconf && sconf->was_initialized == JK_FALSE) {
+            sconf->was_initialized = JK_TRUE;
+            open_jk_log(srv, p);
             sconf->options &= ~sconf->exclude_options;
             if (!uri_worker_map_alloc(&(sconf->uw_map),
                                       sconf->uri_to_context, sconf->log))
@@ -2865,11 +2869,9 @@
 /** BEGIN SREVILAK
  * body taken from exit_handler()
  */
-static void jk_generic_cleanup(server_rec * s)
+static void jk_generic_cleanup(server_rec *s)
 {
 
-    server_rec *tmp = s;
-
     if (jk_worker_properties) {
         jk_map_free(&jk_worker_properties);
         jk_worker_properties = NULL;
@@ -2879,17 +2881,24 @@
     /* loop through all available servers to clean up all configuration
      * records we've created
      */
-    while (NULL != tmp) {
+    while (NULL != s) {
         jk_server_conf_t *conf =
-            (jk_server_conf_t *) ap_get_module_config(tmp->module_config,
+            (jk_server_conf_t *) ap_get_module_config(s->module_config,
                                                       &jk_module);
 
-        if (conf) {
+        if (conf && conf->was_initialized == JK_TRUE) {
+            /* On pool cleanup pass NULL for the jk_logger to
+               prevent segmentation faults on Windows because
+               we can't guarantee what order pools get cleaned
+               up between APR implementations. */
             wc_close(NULL);
-            uri_worker_map_free(&(conf->uw_map), NULL);
-            jk_map_free(&(conf->uri_to_context));
+            if (conf->uri_to_context)
+                jk_map_free(&conf->uri_to_context);
+            if (conf->uw_map)
+                uri_worker_map_free(&conf->uw_map, NULL);
+            conf->was_initialized = JK_FALSE;
         }
-        tmp = tmp->next;
+        s = s->next;
     }
 }
 

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=580798&r1=580797&r2=580798&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 Sep 30 14:51:29 2007
@@ -2269,18 +2269,17 @@
             (jk_server_conf_t *) ap_get_module_config(s->module_config,
                                                       &jk_module);
 
-        if (conf && conf->uw_map) {
+        if (conf && conf->was_initialized == JK_TRUE) {
             /* On pool cleanup pass NULL for the jk_logger to
                prevent segmentation faults on Windows because
                we can't guarantee what order pools get cleaned
                up between APR implementations. */
-            if (conf->was_initialized)
-                wc_close(NULL);
+            wc_close(NULL);
             if (conf->uri_to_context)
                 jk_map_free(&conf->uri_to_context);
             if (conf->uw_map)
                 uri_worker_map_free(&conf->uw_map, NULL);
-            conf->was_initialized   = JK_FALSE;
+            conf->was_initialized = JK_FALSE;
         }
         s = s->next;
     }
@@ -2766,7 +2765,7 @@
     if (!s->is_virtual) {
         conf = (jk_server_conf_t *)ap_get_module_config(s->module_config,
                                                         &jk_module);
-        if (!conf->was_initialized) {
+        if (conf->was_initialized == JK_FALSE) {
             conf->was_initialized = JK_TRUE;
             /* step through the servers and open each jk logfile
              * and do additional post config initialization.
@@ -2774,9 +2773,10 @@
             for (; srv; srv = srv->next) {
                 jk_server_conf_t *sconf = (jk_server_conf_t *)ap_get_module_config(srv->module_config,
                                                                                    &jk_module);
-                if (open_jklog(srv, pconf))
-                    return HTTP_INTERNAL_SERVER_ERROR;
-                if (sconf) {
+                if (sconf && sconf->was_initialized == JK_FALSE) {
+                    sconf->was_initialized = JK_TRUE;
+                    if (open_jklog(srv, pconf))
+                        return HTTP_INTERNAL_SERVER_ERROR;
                     sconf->options &= ~sconf->exclude_options;
                     if (!uri_worker_map_alloc(&(sconf->uw_map),
                                               sconf->uri_to_context, sconf->log))



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


Mime
View raw message