On Fri, 23 Jun 2006, Perrin Harkins wrote: > 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.
I see. In that case it would be a problem if two children try to write the socket at the same time, right? That would be a bad idea. Might as well use Apache::DBI instead of re-inventing. > > 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. My impression was it was different, and that it does some kind of management for that, but I could be wrong. >From the man page: "It has auto-increment support for SQLite, MySQL, PostgreSQL, Oracle, SQL Server and DB2 and is known to be used in production on at least the first four, and is fork- and thread-safe out of the box (although your DBD may not be)." Mark 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

