Graham Dumpleton
grahamd at dscpl.com.au
Wed Oct 18 18:23:18 EDT 2006
Roger wrote .. > I am running apache 2.0.54 and mod_python 3.2.10 on Fedora Core 4. I am > running both Webware and MoinMoin under mod_python as a means of > speeding up the applications. > > My problem is that the MoinMoin modules (the second application defined) > are being reloaded with each request. A logging message inserted into > the MoinMoin request.py module verifies this. I found this problem > while investigating the cause of why my newly written MoinMoin macros > were crashing after MySQL ran out of available connections. > > This problem does not occur on my test system under Windows/XP with > apache 2.0.53 and mod_python 3.2.5. I had been running mod_python 3.1.4 > under Fedora Core 4 and have upgraded to 3.2.10 but the problem persists. > > Some snippets from httpd.conf: > > LoadModule python_module modules/mod_python.so > > # Webware WebKit > <Location /webkit > > SetHandler python-program > # add the directory that contains ModPythonAdapter.py > PythonPath "sys.path+['/home/web/Webware']" > PythonOption AppWorkDir /home/web/dra > PythonHandler WebKit.Adapters.ModPythonAdapter > PythonDebug On > </Location> > > # MoinMoin > <Location /drawiki> > SetHandler python-program > PythonPath "['/home/web/Moin/drawiki/']+sys.path" > PythonHandler MoinMoin.request::RequestModPy.run > PythonDebug On > </Location> > > Any suggestions as to what I may be doing wrong? The messages in the error log file do not show the process ID for the Apache child process that performed the import. Nor do they distinguish between an initial load and a reload, nor which Python interpreter instance performed the load. FWIW, both all issues are addressed in mod_python 3.3. Why this is important is that if you are using Apache in prefork mode, whereby there are multiple Apache child processes, you may be confusing messages generated from different Apache child processes as indicating that a module is being reloaded on ever request. Instead, all that may be happening is that each request is going to a different Apache child process and it takes a while before all Apache child processes have been involved in handling a request for that application and before the messages stop appearing. If you have been having problems with Apache child processes crashing at regular intervals, then the messages may just keep appearing as Apache creates new child processes to replace those which have died. Also, if you have a low count for the number of requests that any one Apache child process should handle before Apache shuts down that process, you may have a high turn over of processes and thus again a continual stream of messages. Thus make sure that you don't have MaxRequestsPerChild directive set in main Apache configuration to some low value. In case you are worried that it is somehow due to an interaction between the two different applications you are hosting, then forcible separate them into their own Python interpreter instances with each Apache child process by using the PythonInterpreter directive. Ie., In MoinMoin use: PythonInterpreter wiki and in the other use: PythonInterpreter webware Graham
|