Re: forking problem with dbd::mysql
- From: tom@xxxxxxxxxxx (Tom Allison)
- Date: Wed, 9 May 2007 22:06:34 -0400
On May 9, 2007, at 5:41 PM, Jeff Pang wrote:
-----Original Message-----From: Chas Owens <chas.owens@xxxxxxxxx>
The solution:
Setting a flag (InactiveDestroy) on the parent's handle inside the
child process prevents the automagic closing of the connection.
* the magic in this case is the DESTROY method of DBI::db
Using InactiveDestroy flag seems a standard way since this module's author provide this flag.
But it's maybe bring some problems when the applications are large enough,and it's not the fact that every programmer would disconnect their dbh connections in time.For example,consider the case programs were run under modperl and without Apache::DBI,using this flag would possibly make lots of db connections to database and consume db's socket source quickly.
Then for me I would maybe consider another way of creating its own dbh in child after fork.
Hope I'm right,:)
From perldoc:
This attribute is specifically designed for use in Unix applica-
tions that "fork" child processes. Either the parent or the child
process, but not both, should set "InactiveDestroy" on all their
shared handles. Note that some databases, including Oracle, don't
support passing a database connection across a fork.
In short -- you are lucky it can be supported.
But in order to keep things portable, this might be something to avoid?
.
- Follow-Ups:
- Re: forking problem with dbd::mysql
- From: Chas Owens
- Re: forking problem with dbd::mysql
- References:
- Re: forking problem with dbd::mysql
- From: Jeff Pang
- Re: forking problem with dbd::mysql
- Prev by Date: Re: forking problem with dbd::mysql
- Next by Date: Re: forking problem with dbd::mysql
- Previous by thread: Re: forking problem with dbd::mysql
- Next by thread: Re: forking problem with dbd::mysql
- Index(es):
Relevant Pages
|