On Jan 20, 2011, at 4:41 PM, Damon Courtney wrote:

>>> so slave interpreters don't inherit packages loaded in their parent
>> interp? Getting the answer should be easy...
> 
> 
> I don't even think this is possible.  You're talking about creating an interp 
> in the parent httpd process and then somehow handing that off to each child 
> as a copy as it's created?  I think that's a great idea, but I don't see how 
> to implement it.  AOLServer has this idea of cloning interpreters, but 
> they're always working within the same process not multiple children.  And I 
> don't even know if THEY clone the entire interpreter, packages and all. I 
> would think they do though if it's a true interp clone.
> 
> I would love to be proven wrong though. 0-]  I don't have near the kind of 
> load you guys are using, but the idea of cloning a full interpreter has been 
> an idea I've wanted for a long time.  Cloning within the same process is 
> possible.  Cloning in a child? *shrug*

Early in the development of the interp command I asked for "interp clone", 
which would drive through one interpreter and copy all the procs, arrays, 
namespaces, etc, from one interpreter into another.  It would still be badass, 
but the capability doesn't exist and isn't needed for what I'm describing.

Definitely if you fork a process that has a Tcl interpreter, the child will 
have a copy of the Tcl interpreter in the same state as the parent.  The only 
problem with that is that certain initializations can't be done before the 
fork.  For instance if I have an open connection to a postgresql server and I 
fork, the parent and the child will both have the same connection and that 
won't work.  So the developer needs to make sure that they get the packages 
loaded that all children need but that they don't initialize any stuff that 
can't or shouldn't happen until after the fork.

So the idea is the parent Apache process, when it does Rivet module 
initialization, we go do most or all of the stuff in Rivet_InitTclStuff on the 
master.  Like in FlightAware's case load 400+ packages.  Then the Apache server 
forks and, if separate virtual interpreters it has to do all the creation and 
initialization of each interpreter in the child as before.  But if it's not 
configured for separate virtual interpreters, the parent performs all of the 
GlobalInitScript stuff, which the child inherits, then the child invokes the 
Rivet ChildInitScripts scripts.  This is where you establish your database 
connections or whatever other stuff can't be done until after the fork.

OK, after all that, I don't know if it can be done either.

Oh also if separate virtual interpreters are defined, I think it still creates 
a root interpreter even though it doesn't use it.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to