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/11/09 07:21:24 UTC

svn commit: r472785 - in /httpd/mod_python/trunk: Doc/appendixc.tex lib/python/mod_python/__init__.py src/include/mpversion.h src/mod_python.c

Author: grahamd
Date: Wed Nov  8 22:21:23 2006
New Revision: 472785

URL: http://svn.apache.org/viewvc?view=rev&rev=472785
Log:
(MODPYTHON-195) Fix potential Win32 resource leaks in parent Apache process
when process restarts occur.


Modified:
    httpd/mod_python/trunk/Doc/appendixc.tex
    httpd/mod_python/trunk/lib/python/mod_python/__init__.py
    httpd/mod_python/trunk/src/include/mpversion.h
    httpd/mod_python/trunk/src/mod_python.c

Modified: httpd/mod_python/trunk/Doc/appendixc.tex
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/Doc/appendixc.tex?view=diff&rev=472785&r1=472784&r2=472785
==============================================================================
--- httpd/mod_python/trunk/Doc/appendixc.tex (original)
+++ httpd/mod_python/trunk/Doc/appendixc.tex Wed Nov  8 22:21:23 2006
@@ -459,6 +459,10 @@
       Fixed potential memory leak due to not clearing the state of thread state
       objects before deleting them.
     \item
+      (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-195]{MODPYTHON-195})
+      Fix potential Win32 resource leaks in parent Apache process when process
+      restarts occur.
+    \item
       (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-198]{MODPYTHON-198})
       Python 2.5 broke nested __auth__/__access__/__auth_realm__ in
       mod_python.publisher.

Modified: httpd/mod_python/trunk/lib/python/mod_python/__init__.py
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/lib/python/mod_python/__init__.py?view=diff&rev=472785&r1=472784&r2=472785
==============================================================================
--- httpd/mod_python/trunk/lib/python/mod_python/__init__.py (original)
+++ httpd/mod_python/trunk/lib/python/mod_python/__init__.py Wed Nov  8 22:21:23 2006
@@ -20,5 +20,5 @@
 __all__ = ["apache", "cgihandler", "psp",
            "publisher", "util", "python22"]
 
-version = "3.3.0-dev-20061107"
+version = "3.3.0-dev-20061109"
 

Modified: httpd/mod_python/trunk/src/include/mpversion.h
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/src/include/mpversion.h?view=diff&rev=472785&r1=472784&r2=472785
==============================================================================
--- httpd/mod_python/trunk/src/include/mpversion.h (original)
+++ httpd/mod_python/trunk/src/include/mpversion.h Wed Nov  8 22:21:23 2006
@@ -1,5 +1,5 @@
 #define MPV_MAJOR 3
 #define MPV_MINOR 3
 #define MPV_PATCH 0
-#define MPV_BUILD 20061107
-#define MPV_STRING "3.3.0-dev-20061107"
+#define MPV_BUILD 20061109
+#define MPV_STRING "3.3.0-dev-20061109"

Modified: httpd/mod_python/trunk/src/mod_python.c
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/src/mod_python.c?view=diff&rev=472785&r1=472784&r2=472785
==============================================================================
--- httpd/mod_python/trunk/src/mod_python.c (original)
+++ httpd/mod_python/trunk/src/mod_python.c Wed Nov  8 22:21:23 2006
@@ -741,6 +741,20 @@
      */
     static int initialized = 0;
 
+#ifdef WIN32
+    /* No need to run python_init() in Win32 parent processes as
+     * the lack of fork on Win32 means we get no benefit as far as
+     * inheriting a preinitialized Python interpreter. Further,
+     * upon a restart on Win32 platform the python_init() function
+     * will be called again in the parent process but without some
+     * resources allocated by the previous call having being
+     * released properly, resulting in memory and Win32 resource
+     * leaks.
+     */
+    if (!getenv("AP_PARENT_PID"))
+        return OK;
+#endif /* WIN32 */
+
     apr_pool_userdata_get(&data, userdata_key, s->process->pool);
     if (!data) {
         apr_pool_userdata_set((const void *)1, userdata_key,