[CDBI] Forking and reconnecting to the database

Aaron Trevena aaron.trevena at gmail.com
Tue Mar 7 19:41:41 GMT 2006


Hi all,

I've been reading about how to handle CDBI classes when forking and am
struggling to get a grasp of the picture - naturally, there's no clear
explaination in the cdbi or Ima::DBI docs anywehere, so I have found
pieces of the puzzle like :
http://www.spanner.org/lists/cdbi/2005/11/07/eb3bb63e.html

.. which explains that I need a new connection after forking and using
$dbh->{InactiveDestroy}, but it looks like I need subclass the
connection methods of either Ima::DBI or Class::DBI and thats more
work and less documentation that i'd really like.

The project concerned is a daemon which forks off shortlived children
to do jobs using a several objects, obviously only the id's are passed
to the child, but fetching from the id's again results in a cascade of
errors, not helped by DBD::Pg and Class::DBI::Pg  being rather flakey
(buggy pings, postgres being as cooperative as a drunken boar that's
just been slapped in the face).

Any more pointers as searching for fork and cdbi in google just brings
up people panicing about the DBIx::Class shenanigans and the post
above which although apparently helpful covers different error
messages, and uses stuff I haven't seen documented anywhere else.

cheers for any help - I'm finding moving a pretty complicated
scheduling system from MySQL to Postgres considerably more stressful
than I expected.. *sigh*

A.




More information about the ClassDBI mailing list