Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- DBI and fork
May 15, 2009, 7:48 pm
rate this thread
Re: DBI and fork
No. If the test program crashes immediatly you know that the parent
process is affected. But what if works ok? You still don't know that a
more complex program will work, maybe under higher load.
What you should do is read perldoc DBI and search for "fork". You will
find this section:
The default value, false, means a handle will be fully destroyed as
normal when the last reference to it is removed, just as you’d expect.
If set true then the handle will be treated by the DESTROY as if it was
no longer Active, and so the database engine related effects of
DESTROYing a handle will be skipped.
Think of the name as meaning ’treat the handle as not-Active in the
For a database handle, this attribute does not disable an explicit call
to the disconnect method, only the implicit call from DESTROY that
happens if the handle is still marked as "Active".
This attribute is specifically designed for use in Unix applications
that "fork" child processes. Either the parent or the child process,
but not both, should set "InactiveDestroy" true on all their shared
handles. (Note that some databases, including Oracle, don’t support
passing a database connection across a fork.)
- Xho Jingleheimerschmidt
May 16, 2009, 11:15 pm
Re: DBI and fork
Why do you do that? Have you read the part in the docs that discuss
Maybe, maybe not. It depends on the driver, and on what the parent
tries to do. If the parent does nothing but call POSIX:_exit, then
it probably won't be affected.