Graham Dumpleton
graham.dumpleton at gmail.com
Mon May 14 20:33:15 EDT 2007
Did half suspect that setting AP_PARENT_ID may screw up other things. :-( And yes your feedback does suggest that the AP_PARENT_ID change in the code needs to be undone. I hope that Jeff Robins who originally suggested the change is noting this conversation. :-) What really needs to be done is for the mod_python parent process initialisation to be completely rewritten so that it properly destroys the Python interpreter and the global mutex locks it creates when appropriate Apache memory pool is destroyed so that when an Apache restart is done that everything is undone and memory reclaimed. On the reinitialisation mod_python would then do everything over again instead of skipping it because of Python already being initialised. Does also means that one can't skip initialising the interpreter in the main process on Windows even if redundant on that platform for normal case. Luckily I have been through working out what needs to be done in doing all this stuff properly for mod_wsgi. Graham On 15/05/07, René Grob <rpgrob at hispeed.ch> wrote: > Graham Dumpleton schrieb: > > BTW, a couple of things to try. > > > > 1. See if running httpd with options '-X -DONE_PROCESS' makes a > > difference. > > > > 2. See if you can arrange for environment variable called > > 'AP_PARENT_PID' to be set to '0' in the environment that the httpd > > process is running so as to stop mod_python avoiding its > > initialisation step. Am not sure what magic is required on Windows to > > set environment variables. > > > > Graham > > > > On 11/05/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote: > >> I suspect it is because of this change being made: > >> > >> http://issues.apache.org/jira/browse/MODPYTHON-195 > >> > >> I had been recently wondering whether the change would upset single > >> process debugging. > >> > >> As it is, the issue has had to be reopened because it causes another > >> minor nuisance issue with version information for Python/mod_python > >> not being displayed. > >> > >> Do you have the ability to compile mod_python from source code > >> yourself and thereby remove the change described in that issue and see > >> if it then works? > >> > >> It still may be the case however that single process debugging has > >> never worked on Windows for one reason or another since people so > >> rarely use it. > >> > >> Graham > >> > >> On 11/05/07, René Grob <rpgrob at hispeed.ch> wrote: > >> > Since my small intranet application keeps getting more complex I tried > >> > to fix some bugs using the Python Debugger. According to the > >> Mod_python > >> > manual I added the "PythonEnablePdb On" directive into the directory > >> > context of my Python application and started httpd from the command > >> line > >> > with the option -DONE_PROCESS (after stopping httpd first, of course). > >> > But Apache didn't start and an error window occurred instead > >> showing the > >> > following message: > >> > > >> > "Runtime Error! Program: <Apache path>\httpd.exe. This application has > >> > requested the Runtime to terminate it in an unusual way. Please > >> contact > >> > the applications's support team for more information". > >> > > >> > I'm using the following prebuilt binaries on Win2k SP4: > >> > > >> > mod_python-3.3.1.win32-py2.5-Apache2.2.exe > >> > python-2.5.msi > >> > apache_2.2.4-win32-x86-no_ssl.msi > >> > > >> > When Apache is started with the option -DONE_PROCESS but without > >> > Mod_python there is no error and no Mod_python either (of course). > >> On a > >> > different machine with WinXP SP2, Apache 2.2.3, Python 2.4.3 and > >> > Mod_python 2.7.10 the debugger works as expected. > >> > > >> > Does anyone have an idea how to fix this? > >> > > >> > Thanks > >> > > >> > René > >> > > >> > _______________________________________________ > >> > Mod_python mailing list > >> > Mod_python at modpython.org > >> > http://mailman.modpython.org/mailman/listinfo/mod_python > >> > > >> > > > Dear Graham > > Thanks for your immediate answer. Your first suggestion, to recompile > Modpython with the indicated corrections will probably > > be the best. But unfortunately I do not have a Microsoft compiler in my > box. Does anybody know wether I can use the freely > > downloadable C++ 'express' version for this? > > So I tried out your second suggestions: Starting httpd with the '-X > -DONE_PROCESS' option results in the same runtime error. > > The same happens when I add the '-X' option alone. After setting the > environment variable AP_PARENT_PID to 0 (which is really > > no magic: simply type 'set AP_PARENT_PID=0' <enter> at the command line > [without the quotes]) strange things happen. Apache > > aborts with the following error: > > 'httpd: Could not open configuration file /apache/conf/httpd.conf: The > system cannot find the indicated path' > > This is independent of wether I add the '-DONE_PROCESS' and/or the '-X' > option or none at all. > > After adding the option '-f <path to httpd.conf>/httpd.conf' Apache > seems to start but the shell returns to the prompt after a > > second without any error message. Looking up the process list doesn't > show any httpd running. So I had a look at the error.log > > where I found the following messages: > > [Mon May 14 23:20:31 2007] [notice] mod_python: Creating 8 session > mutexes based on 0 max processes and 250 max threads. > [Mon May 14 23:20:31 2007] [notice] Child 2176: Child process is running > [Mon May 14 23:20:31 2007] [crit] (OS 6)Invalid Handle. : Child 2176: > Unable to retrieve the ready event from the parent > > With the '-DONE_PROCESS'and/or '-X' option it looks a bit different but > essentially with the same result: > > [Mon May 14 23:28:05 2007] [notice] mod_python: Creating 8 session > mutexes based on 0 max processes and 250 max threads. > [Mon May 14 23:28:06 2007] [notice] Child 1084: Child process is running > [Mon May 14 23:28:06 2007] [notice] Child 1084: Acquired the start mutex. > [Mon May 14 23:28:06 2007] [notice] Child 1084: Starting 250 worker threads. > [Mon May 14 23:28:06 2007] [crit] (OS 6)Invalid Handle. : Child 1084: > WAIT_FAILED -- shutting down server > [Mon May 14 23:28:06 2007] [notice] Child 1084: Starting thread to > listen on port 80. > [Mon May 14 23:28:07 2007] [notice] Child 1084: Released the start mutex > [Mon May 14 23:28:08 2007] [notice] Child 1084: Waiting for 250 worker > threads to exit. > [Mon May 14 23:28:08 2007] [notice] Child 1084: All worker threads have > exited. > [Mon May 14 23:28:08 2007] [notice] Child 1084: Child process is exiting > > > By the way I tried to start the debugger on a different installation > with Apache 2.2.3, Modpython 3.2.10 and Python 2.43 on > > WinXPSP2. It worked just as expected. The same was true for an older > installation using Apache 2.0.52, Modpython 3.1.3 and > > Python 2.3.4 on WinXPSP1. So the 'problem' must have been introduced > very recently...(I'm sorry I mixed up the version number > > of Modpython in the first post: I didn't test Modpython 2.7.10). > > This additional information probably supports your hypothesis that the > problem is related to > > http://issues.apache.org/jira/browse/MODPYTHON-195 doesn't it? > > René >
|