On Fri, 2006-06-23 at 11:11 -0700, Mark Hedges wrote:
> That doesn't happen.  The Perl interpreter and all objects in it 
> get cloned to each Apache child.  Whatever you set up in startup 
> is cloned for each child, so it isn't actually the same 
> structure, package or symbol table.  You can pre-populate data 
> to be cloned to children, but children don't share any memory. 

True, but the same cannot be said for open sockets, which is the issue
here.  If you open a database connection during startup and cache it
yourself (as opposed to letting Apache::DBI do it), you will end up
trying to use the same connection from multiple children.  Similar
problems crop up with XS modules that have data structures in C that the
perl code just points to -- they don't work across forks.

> You ought to check out DBIx::Class.  Not only would it roll the 
> wheels you are trying to re-invent with your objects (I tried 
> that too), but under FastCGI it actually does what you want -- 
> all processes use the same connection, and it manages them.

I don't believe it's possible for them to share the same connection
safely under FastCGI, since it is multi-process, just like mod_perl with
the prefork MPM.  The DBIx::Class code never shares connections across
processes or threads.

- Perrin


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to