Skip Menu |

This queue is for tickets about the CGI-Session CPAN distribution.

Report information
The Basics
Id: 46264
Status: resolved
Priority: 0/
Queue: CGI-Session

People
Owner: Nobody in particular
Requestors: eponymousalias [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: failure to clean up in CGI::Session:Driver::DBI routines
Date: Wed, 20 May 2009 21:50:49 -0700 (PDT)
To: bug-CGI-Session [...] rt.cpan.org
From: eponymous alias <eponymousalias [...] yahoo.com>
The CGI-Session-4.00_08/Session/Driver/DBI.pm routines do not properly close out their statement handles before returning. This results in resources needlessly held for the duration of the session, and in error messages when the database handle is ultimately closed. For instance, the code needs the following change: --- DBI.pm.orig Fri Feb 11 00:18:27 2005 +++ DBI.pm Wed May 20 21:35:27 2009 @@ -57,6 +57,7 @@ $sth->execute( $sid ) or return $self->set_error( "retrieve(): \$sth->execute failed with error message " . $dbh->errstr); my ($row) = $sth->fetchrow_array(); + $sth->finish; return 0 unless $row; return $row; } As an example of what the present construction causes, we see the following message continually in the Apache error logs: DBI::db=HASH(0x2439990)->disconnect invalidates 1 active statement handle (either destroy statement handles or call finish on them before disconnecting) due to the particular missing cleanup noted above. That kind of fix (adding $sth->finish; calls) applies not just to the retrieve routine, but also to most other routines in the DBI.pm file. Every time a local statement handle is created in such a routine, it should be destroyed with a $sth->finish; call before the routine is exited, no matter what code path is followed.
Subject: Re: [rt.cpan.org #46264] AutoReply: failure to clean up in CGI::Session:Driver::DBI routines
Date: Thu, 21 May 2009 00:42:59 -0700 (PDT)
To: bug-CGI-Session [...] rt.cpan.org
From: eponymous alias <eponymousalias [...] yahoo.com>
Just after I posted this bug report, I found the latest release of CGI::Session, and I see it is fixed in that release. Sorry for the noise. --- On Wed, 5/20/09, Bugs in CGI-Session via RT <bug-CGI-Session@rt.cpan.org> wrote: Show quoted text
> From: Bugs in CGI-Session via RT <bug-CGI-Session@rt.cpan.org> > Subject: [rt.cpan.org #46264] AutoReply: failure to clean up in CGI::Session:Driver::DBI routines > To: eponymousalias@yahoo.com > Date: Wednesday, May 20, 2009, 9:51 PM > > Greetings, > > This message has been automatically generated in response > to the > creation of a trouble ticket regarding: > "failure to clean up in > CGI::Session:Driver::DBI routines", > a summary of which appears below. > > There is no need to reply to this message right now. > Your ticket has been > assigned an ID of [rt.cpan.org #46264]. Your ticket > is accessible > on the web at: > > http://rt.cpan.org/Ticket/Display.html?id=46264 > > Please include the string: > > [rt.cpan.org > #46264] > > in the subject line of all future correspondence about this > issue. To do so, > you may reply to this message. > > > Thank you, > > bug-CGI-Session@rt.cpan.org > > ------------------------------------------------------------------------- > > The CGI-Session-4.00_08/Session/Driver/DBI.pm routines do > not > properly close out their statement handles before > returning. > This results in resources needlessly held for the duration > of > the session, and in error messages when the database > handle > is ultimately closed. For instance, the code needs > the > following change: > > --- DBI.pm.orig Fri Feb 11 00:18:27 2005 > +++ DBI.pm Wed May 20 > 21:35:27 2009 > @@ -57,6 +57,7 @@ > $sth->execute( > $sid ) or return $self->set_error( "retrieve(): > \$sth->execute failed with error message " . > $dbh->errstr); > > my ($row) = > $sth->fetchrow_array(); > + $sth->finish; > return 0 unless > $row; > return $row; > } > > As an example of what the present construction causes, we > see > the following message continually in the Apache error > logs: > > DBI::db=HASH(0x2439990)->disconnect > invalidates 1 active > statement handle (either > destroy statement handles or > call finish on them before > disconnecting) > > due to the particular missing cleanup noted above. > > That kind of fix (adding $sth->finish; calls) applies > not just > to the retrieve routine, but also to most other routines > in > the DBI.pm file. Every time a local statement handle > is > created in such a routine, it should be destroyed with a > $sth->finish; call before the routine is exited, no > matter > what code path is followed. > > > > > >
I'm setting this to Resolved because the submitter has noticed that code had been fixed already.