in reply to DBI lost connection errors

The child processes might be closing the parent's database handle. Look at the InactiveDestroy attribute in the DBI docs. This should be set to true in the child processes (after forking) for the parent db handle. Or, if possible, you should only connect the parent db handle after the forking is done.

And just to be sure, the child processes get their own db handle after forking, right?

Replies are listed 'Best First'.
Re: Re: DBI lost connection errors
by Marcello (Hermit) on Jun 11, 2003 at 17:40 UTC
    ++runig

    This is the problem, I already found out the child processes automatically close the database connections of the parent but couldn't find a way to prevent this. Never noticed this attribute, but InactiveDestroy is the answer for this problem when using DBI and forking childs.

    I've set the InactiveDestroy attribute to true on the parent's database handles and it runs smoothly now.

    Thanks alot!
      I've set the InactiveDestroy attribute to true on the parent's database handles and it runs smoothly now.
      Did you read the part where it says InactiveDestroy should be set to true in the parent and false in the child, or vice-versa, but not true in both? If you are using the handle in the parent (and you usually should not fork and then use an existing handle in the child), then you should set it to false in the parent, fork, then set it to true in the child right after forking. Or you could set it to true, fork, then set it back to false in the parent right after forking.
        Yep I did,

        I set it to true right after the fork in the child. Don't think the child will 'die' just after the fork and before the first statement.

        Grtz Marcello