in reply to Re: Fork-safe DBI handles via ChildHandles and InactiveDestroy
in thread Fork-safe DBI handles via ChildHandles and InactiveDestroy
As far as the fact that a fork can sort of corrupt various resources which aren't even used in the subprocess... well, that's unfortunate, but not isolated to DBI connections. A similar thing happens with IO buffers, necessitating that you do something like "flush all handles" before a fork. Unfortunately, this, too (at least used to be... someone may have fixed this since I last looked into it) has no good solution, as it requires the forking code to somehow reach out and grab a list of all of a process's resources of a type (in this case database handles, in that case buffered IO handles). Similarly, in apache, there's a necessary step of calling "cleanup_for_exec", so that child processes' sockets don't get selected for handling new requests. The list goes on, I'm sure... which is sad, because it means there's a whole laundry list of things you need to remember to do if you want to fork... forgetting to do any of them meaning a potential obscure bug.
------------ :Wq Not an editor command: Wq
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Fork-safe DBI handles via ChildHandles and InactiveDestroy
by Zaxo (Archbishop) on Jun 07, 2007 at 04:41 UTC | |
by etcshadow (Priest) on Jun 07, 2007 at 05:08 UTC | |
Re^3: Fork-safe DBI handles via ChildHandles and InactiveDestroy
by sgt (Deacon) on Jun 07, 2007 at 12:39 UTC |