-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

> Yep, this is a fork without exec. And the child processes often aren't
> even doing any database access -- the database connection's opened and
> held, then a child is forked off, and the child 'helpfully' closes the
> handle during the child's global destruction phase.
> 
> Am I at any risk in the parent process?

Yes. But there is an easy solution, asuming you are using DBI:

$dbh->{InactiveDestroy} = 1;

This tells DBI not to do anything special when inside of DESTROY. Set 
on the kids immediately after forking.

> "the child processes often aren't even doing any database access"
                       ^^^^^^^^^^^^

Often aren't? This should be "never", period, unless the parent contracts 
to stop doing database access after the fork. You can't have two processes 
sharing a handle.

Note also that InactiveDestroy should not be your first choice. Far 
better to do the forking before the database connection whenever possible. 
If they both need access, you can also disconnect, fork, and have both 
reconnect afterwards.

- --
Greg Sabino Mullane [EMAIL PROTECTED]
End Point Corporation
PGP Key: 0x14964AC8 200711131332
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFHOe7qvJuQZxSWSsgRA/BUAJ4tfyoZja93h3q6EtJ3lHiGRRODOACg/M2Y
5VlkKiSZNfstdgrD5Ru+Q/c=
=OjGF
-----END PGP SIGNATURE-----



---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to