Author: mturk
Date: Tue Mar 13 03:20:28 2007
New Revision: 517629

URL: http://svn.apache.org/viewvc?view=rev&rev=517629
Log:
Fix shared memory initialization. The file descriptors must be reopened in 
child process.

Modified:
    tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
    tomcat/connectors/trunk/jk/native/common/jk_shm.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?view=diff&rev=517629&r1=517628&r2=517629
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Tue Mar 13 03:20:28 
2007
@@ -2787,10 +2787,28 @@
     return DECLINED;
 }
 
-static void exit_handler(server_rec * s, ap_pool * p)
+static void child_exit_handler(server_rec * s, ap_pool * p)
 {
     /* srevilak - refactor cleanup body to jk_generic_cleanup() */
     jk_generic_cleanup(s);
+    jk_shm_close();
+}
+
+static void child_init_handler(server_rec * s, ap_pool * p)
+{
+    int rc;
+    jk_server_conf_t *conf =
+        (jk_server_conf_t *) ap_get_module_config(s->module_config,
+                                                  &jk_module);
+
+    if ((rc = jk_shm_attach(jk_shm_file, jk_shm_size, conf->log)) == 0) {
+        if (JK_IS_DEBUG_LEVEL(conf->log))
+            jk_log(conf->log, JK_LOG_DEBUG, "Attached shm:%s",
+                   jk_shm_name());
+    }
+    else
+        jk_log(conf->log, JK_LOG_ERROR, "Attaching shm:%s errno=%d",
+               jk_shm_name(), rc);
 }
 
 
@@ -2855,8 +2873,8 @@
     jk_fixups,                  /* [8] fixups */
     NULL,                       /* [10] logger */
     NULL,                       /* [3] header parser */
-    NULL,                       /* apache child process initializer */
-    exit_handler,               /* apache child process exit/cleanup */
+    child_init_handler,         /* apache child process initializer */
+    child_exit_handler,         /* apache child process exit/cleanup */
     NULL                        /* [1] post read_request handling */
 #ifdef EAPI
         /*

Modified: tomcat/connectors/trunk/jk/native/common/jk_shm.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_shm.c?view=diff&rev=517629&r1=517628&r2=517629
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_shm.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_shm.c Tue Mar 13 03:20:28 2007
@@ -280,10 +280,8 @@
     JK_TRACE_ENTER(l);
     if (jk_shmem.hdr) {
         /* Probably a call from vhost */
-        if (JK_IS_DEBUG_LEVEL(l))
-            jk_log(l, JK_LOG_DEBUG,
-                    "Shared memory is already open");
-        return 0;
+        if (!attached)
+            attached = 1;
     }
     jk_shmem.filename = fname;
     if (attached)



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to