You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by gr...@apache.org on 2006/03/21 23:38:33 UTC

svn commit: r387656 - in /httpd/mod_python/trunk: Doc/appendixc.tex src/mod_python.c

Author: grahamd
Date: Tue Mar 21 14:38:30 2006
New Revision: 387656

URL: http://svn.apache.org/viewcvs?rev=387656&view=rev
Log:
In a multithread MPM, the apache.init() function could be called
more than once for a specific interpreter instance whereas it should
only be called once. (MODPYTHON-150)

Modified:
    httpd/mod_python/trunk/Doc/appendixc.tex
    httpd/mod_python/trunk/src/mod_python.c

Modified: httpd/mod_python/trunk/Doc/appendixc.tex
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/Doc/appendixc.tex?rev=387656&r1=387655&r2=387656&view=diff
==============================================================================
--- httpd/mod_python/trunk/Doc/appendixc.tex (original)
+++ httpd/mod_python/trunk/Doc/appendixc.tex Tue Mar 21 14:38:30 2006
@@ -185,6 +185,11 @@
       \code{apache.HTTP_UPGRADE_REQUIRED}. Also added new constants for
       Apache magic mime types and values for interpreting the
       \code{req.connection.keepalive} and \code{req.read_body} members.
+    \item
+      (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-150]{MODPYTHON-150})
+      In a multithread MPM, the \code{apache.init()} function could be called
+      more than once for a specific interpreter instance whereas it should
+      only be called once.
   \end{itemize}
 
 \chapter{Changes from Version (3.2.7)\label{app-changes-from-3.2.7}}

Modified: httpd/mod_python/trunk/src/mod_python.c
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/src/mod_python.c?rev=387656&r1=387655&r2=387656&view=diff
==============================================================================
--- httpd/mod_python/trunk/src/mod_python.c (original)
+++ httpd/mod_python/trunk/src/mod_python.c Tue Mar 21 14:38:30 2006
@@ -187,13 +187,13 @@
 #ifdef WITH_THREAD
     PyEval_ReleaseLock();
 #endif
-#if APR_HAS_THREADS
-    apr_thread_mutex_unlock(interpreters_lock);
-#endif
 
     if (! idata) {
         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, srv,
                      "get_interpreter: cannot get interpreter data (no more memory?)");
+#if APR_HAS_THREADS
+        apr_thread_mutex_unlock(interpreters_lock);
+#endif
         return NULL;
     }
 
@@ -219,9 +219,16 @@
             PyThreadState_Delete(tstate);
             ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, srv,
                       "get_interpreter: no interpreter callback found.");
+#if APR_HAS_THREADS
+            apr_thread_mutex_unlock(interpreters_lock);
+#endif
             return NULL;
         }
     }
+
+#if APR_HAS_THREADS
+    apr_thread_mutex_unlock(interpreters_lock);
+#endif
 
     return idata;
 }