[mod_python] Child process init handler

Michael C. Neel neel at mediapulse.com
Tue Jan 27 17:12:26 EST 2004


Mod_perl is able is so this somehow:

PerlChildInitHandler and PerlChildExitHandler do not refer to parts of
the request loop, they are to allow your modules to initialize data
structures and to clean up at the child process start-up and shutdown
respectively, for example by allocating and deallocating memory.


--
Michael C. Neel
Mediapulse, Inc. 

> -----Original Message-----
> From: Gregory (Grisha) Trubetskoy [mailto:grisha at modpython.org] 
> Sent: Tuesday, January 27, 2004 4:09 PM
> To: Michael C. Neel
> Cc: Mod_python at modpython.org
> Subject: Re: [mod_python] Child process init handler
> 
> 
> 
> Apache doesn't really lend itself to this kind of thinking. I've never
> been able to clearly pinpoint what the problem is, but it 
> basically has to
> do with a lot of request parameters being generated on the 
> fly as a result
> of the combination of the particular's of the request and the apache
> configuration directives applicable to that request (which too are
> determined at runtime).
> 
> Or, to put it another way - Apache's approach is "reactive" 
> rather than
> "proactive". When it parses its config it takes very little 
> action on the
> things it sees in it. Virtual servers just get piled into a 
> hash list, and
> only when a request for that particular server comes in is a 
> meaningful
> combination of a server and request object created. It's not like it
> "intializes" virtual servers at any point during start up, so 
> there is no
> "virtual server init" hook.
> 
> In theory, when a child is spawned, mod_python could try to walk the
> config and try to make sense of it and create and call some sort of a
> per-server init hook, but that would more trouble than it's worth IMO.
> 
> Grisha
> 
> On Tue, 27 Jan 2004, Michael C. Neel wrote:
> 
> > What I want to do:
> >
> > 	Run some initialization code when Apache spawns the child
> > process.  I do not want to call this handler for every 
> request, but I do
> > want to have access to the configuration, specifically PythonOptions
> >
> > In looking though the docs, I'm not sure PythonInitHandler 
> works this
> > way, and PythonImport may not be able to access the PythonOption
> > directives.  Is there something I'm overlooking?
> >
> > Mike
> >
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
> 



More information about the Mod_python mailing list