in reply to Is DBI trapping CHLD sigs, is there a workaround?

All kinds of evil things may happen when you fork with an open database connection.

What (if anything) happens depends on the database system, what you do to the connection after forking, ...

I don't have the answer to what happens in your case

The problem is that the database system is not prepared to have several process share the same connection - the purpose of the connection is to give a single channel of access, when that is shared evereything might break.

Neither the DBI or the database systems are 'fork-safe'. The DBI is not really threadsafe yet. Most DBD-drivers are definitely not thread safe.

So avoid forking when you have an active database connection.

  • Comment on Re: Is DBI trapping CHLD sigs, is there a workaround?

Replies are listed 'Best First'.
Re: Re: Is DBI trapping CHLD sigs, is there a workaround?
by Anonymous Monk on Aug 26, 2001 at 00:15 UTC
    I don't want to do anything with the database connection in the child.

    The database connection is only used in the parent and I intended to keep a persistent connection in the parent so the parent could poll each database and fork a child when some (non db) actions should be taken.

    I have a work around, reassign all tasks among parent and child and let the child build and maintain it's db connection. It means a complete redesign and rewrite of the code...

    Tnx for the info.