I added some logging to python_init in mod_python.c to try to understand
what is going on. Apparently when you run apache as a service on win32 the
python_init function gets called TWICE on restart (I have no idea why) and
the first time is somehow spurious (perhaps it is running in the context of
the parent process that spawns the child process that really services
requests?)
yet python_init allocates stuff anyway which never gets freed, for example
the "interpreters_lock" allocated via
apr_thread_mutex_create(&interpreters_lock, APR_THREAD_MUTEX_UNNESTED, p);
I found this posting on the web
http://mail-archives.apache.org/mod_mbox/httpd-dev/200311.mbox/[EMAIL PROTECTED]
which seems to agree that the ap_hook_post_config callback gets called
twice on win32 running as a service and suggested this hack:
#ifdef WIN32
/* Do not run post_config in the Windows parent process
* The envar AP_PARENT_PID is set in the env list (by mpm_winnt)
* for the child process.
* **WARNING**:
* This check is not as robust as I would like because the name of
this
* envar is subject to change from release to release.
*/
if (!getenv("AP_PARENT_PID")) {
return OK;
}
#endif
I put this into python_init() just to see what would happen and sure enough,
the leaking 4 handles went away. I don't know what to do at this point
since I am uncomfortable with the hack. Yet clearly python_init() is not
expecting to be called twice on restart. Is this an apache bug or a
well-know (heh) feature that modules must protect themselves against?
----- Original Message -----
From: "Graham Dumpleton (JIRA)" <[EMAIL PROTECTED]>
To: <python-dev@httpd.apache.org>
Sent: Friday, October 20, 2006 20:22
Subject: [jira] Created: (MODPYTHON-195) Possible leaking of Win32 event
handles when Apache restarted.
Possible leaking of Win32 event handles when Apache restarted.
--------------------------------------------------------------
Key: MODPYTHON-195
URL: http://issues.apache.org/jira/browse/MODPYTHON-195
Project: mod_python
Issue Type: Bug
Components: core
Affects Versions: 3.2.10
Reporter: Graham Dumpleton
Jeff Robins in:
http://mail-archives.apache.org/mod_mbox/httpd-python-dev/200610.mbox/[EMAIL
PROTECTED]
indicates a belief that when an Apache restart is performed on Windows
that there are a number of Win32 event handles leaked. His belief is that
this seems to be linked to mod_python.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira