Subject: | Database doesn't reconnect when child died |
Date: | Mon, 11 May 2009 11:00:32 +0100 |
To: | bug-POE-Component-SimpleDBI [...] rt.cpan.org |
From: | Paul Williams <info [...] it.alldaypa.com> |
Hi,
Nice one on creating such a good poco for asynchronously connecting
through the DBI. I have switched from EasyDBI to SimpleDBI because you
handle statements much better when the poco isn't connected to the database.
I'm here because there is a bug when a subprocess dies. The module
catches the wheel dying and initiates a new wheel, but if the database
was $_HEAP->{CONNECTED}, it will not reconnect to the database. The
module will instead throw an error saying "Cannot CONNECT NOW when we
are already connected!".
Obviously when a wheel dies, the connection to the database is assumed
to be severed. I have hacked the code to make it work by setting the
CONNECTED param to 0 inside the ChildClosed subroutine.
if ( ! $_[HEAP]->{'SHUTDOWN'} and $_[HEAP]->{'CONNECTED'} ) {
# Create the wheel again
$_[HEAP]->{'CONNECTED'} = 0; ### <- woo :)
$_[KERNEL]->call( $_[SESSION], 'Setup_Wheel' );
}
This might not be the best place to put it but it works for now.
Sorry that I've not provided a clean patch for you, I don't really know
how to do it properly ;/
Thanks very much!
-Paul