in reply to Module for transparently forking a sub?

How about database handles?

Unless I'm mistaken, your forked database handles will go out of scope when the forked process ends, at which point your database will disconnect and the parent process will be left with an unusable disconnected database handles.

Hmm... now that I think about it, maybe it's only the parent process ending that disconnects the child process handles. You'll want to test this to be sure. The child process can clone handles off the parent and set the parent's InactiveDestroy flag. Depending on just how much you expect the child to do with the handles.

  • Comment on Re: Module for transparently forking a sub?

Replies are listed 'Best First'.
Re^2: Module for transparently forking a sub?
by samtregar (Abbot) on Feb 13, 2009 at 20:45 UTC
    You were right the first time - you definitely need to do something to keep the child exiting from messing up your handles, at least with DBD::mysql. Not doing it leads to "server went away" errors in the parent at a random point.

    -sam