You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Honza Pazdziora <ad...@informatics.muni.cz> on 2000/09/07 16:17:49 UTC

Re: Auto rollback using Apache::DBI

On Thu, Sep 07, 2000 at 04:03:04PM +0200, Nicolas MONNET wrote:
> 
> I might get something wrong, but while in non-autocommit, if a script dies
> before rollbacking or commiting, looks like the transaction never gets
> cancelled until I kill -HUP httpd! Quite a problem ...
> 
> Is there any known way to catch this? 

Looking at the code in Apache::DBI 0.87, the handle is only rollbacked
if the AutoCommit is set to zero during connect, not if you do

	$dbh->{'AutoCommit'} = 0;

in your script.

I wonder if the $needCleanup test is wanted at all. We could make it
a configuration option, not to push the cleanup handler, but I believe
that generally the rollback is wanted thing in all cases.

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
 .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain, ...
------------------------------------------------------------------------

Re: Auto rollback using Apache::DBI

Posted by Jeff Horn <je...@intralect.com>.
Yes, I ran into this while I was making a version of Apache::DBI which uses
'reauthenticate' to maintain a single connection per Apache child (per
database) and simply reauthenticate on that connection.  It turned out that
I modified what $Idx was composed of and didn't understand why I was not
getting rollbacks when sessions ended without commits.

I too think that the cleanup handler should ALWAYS be pushed and that the
handler itself should check for the AutoCommit status before issuing a
rollback.  Should be easy enough to implement.

-- Jeff
----- Original Message -----
From: "Honza Pazdziora" <ad...@informatics.muni.cz>
To: "Nicolas MONNET" <ni...@monnet.to>
Cc: <mo...@apache.org>
Sent: Thursday, September 07, 2000 9:17 AM
Subject: Re: Auto rollback using Apache::DBI


> On Thu, Sep 07, 2000 at 04:03:04PM +0200, Nicolas MONNET wrote:
> >
> > I might get something wrong, but while in non-autocommit, if a script
dies
> > before rollbacking or commiting, looks like the transaction never gets
> > cancelled until I kill -HUP httpd! Quite a problem ...
> >
> > Is there any known way to catch this?
>
> Looking at the code in Apache::DBI 0.87, the handle is only rollbacked
> if the AutoCommit is set to zero during connect, not if you do
>
> $dbh->{'AutoCommit'} = 0;
>
> in your script.
>
> I wonder if the $needCleanup test is wanted at all. We could make it
> a configuration option, not to push the cleanup handler, but I believe
> that generally the rollback is wanted thing in all cases.
>
> --
> ------------------------------------------------------------------------
>  Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
>  .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain, ...
> ------------------------------------------------------------------------
>