Skip Menu |

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

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

People
Owner: MARKSTOS [...] cpan.org
Requestors: fenlisesi [...] gmail.com
Cc:
AdminCc:

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



Subject: global destruction error.
The following global destruction errors, seen on Linux 2.6.11 with Perl 5.8.8 and CGI::Session 4.20, seem to be caused by DESTROY() trying to commit() when the handle is no longer valid. If you would consider this a bug, perhaps DESTROY could check whether the Handle is defined (and warn if it is not?). --------- (in cleanup) Can't call method "commit" on unblessed reference at /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line 130 during global destruction. (in cleanup) Can't connect to data source , no database driver specified and DBI_DSN env var not set at /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line 26 (in cleanup) Can't call method "commit" on unblessed reference at /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line 130 during global destruction. ----------
Subject: Re: [rt.cpan.org #24355] global destruction error.
Date: Sat, 13 Jan 2007 11:17:40 -0500
To: bug-CGI-Session [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Show quoted text
> > The following global destruction errors, seen on Linux 2.6.11 with Perl > 5.8.8 and CGI::Session 4.20, seem to be caused by DESTROY() trying to > commit() when the handle is no longer valid. If you would consider this > a bug, perhaps DESTROY could check whether the Handle is defined (and > warn if it is not?). > > --------- > (in cleanup) Can't call method "commit" on unblessed reference > at /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line > 130 during global destruction. > (in cleanup) Can't connect to data source , no database driver > specified and DBI_DSN env var not set at > /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line 26 > (in cleanup) Can't call method "commit" on unblessed reference > at /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line > 130 during global destruction. > ----------
If the DBI handle has gone away, we can't make it come back. However, we can provide a better error message, so I'll consider that a bug. Perhaps something like: "DBI handle is longer available. Aborting." Would you like to work on a patch for something like this? Mark
Subject: Re: [rt.cpan.org #24355] global destruction error.
Date: Sat, 13 Jan 2007 14:19:18 -0500
To: "mark [...] summersault.com via RT" <bug-CGI-Session [...] rt.cpan.org>
From: root <root [...] s1.handalak.com>
Mark, do you think we can somehow avoid this missing handle problem, possibly by implementing it through a singleton class, or any other way, so we can prevent early destruction of the handle? Because if we can solve this problem, we will solve the problem of automatic flush(), I believe. Although, by now, I am not sure how important that is Sherzod On Sat, Jan 13, 2007 at 11:18:40AM -0500, mark@summersault.com via RT wrote: Show quoted text
> > Queue: CGI-Session > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=24355 > >
> > > > The following global destruction errors, seen on Linux 2.6.11 with Perl > > 5.8.8 and CGI::Session 4.20, seem to be caused by DESTROY() trying to > > commit() when the handle is no longer valid. If you would consider this > > a bug, perhaps DESTROY could check whether the Handle is defined (and > > warn if it is not?). > > > > --------- > > (in cleanup) Can't call method "commit" on unblessed reference > > at /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line > > 130 during global destruction. > > (in cleanup) Can't connect to data source , no database driver > > specified and DBI_DSN env var not set at > > /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line 26 > > (in cleanup) Can't call method "commit" on unblessed reference > > at /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line > > 130 during global destruction. > > ----------
> > If the DBI handle has gone away, we can't make it come back. However, we > can provide a better error message, so I'll consider that a bug. Perhaps > something like: > > "DBI handle is longer available. Aborting." > > Would you like to work on a patch for something like this? > > Mark >
Subject: Re: [rt.cpan.org #24355] global destruction error.
Date: Sat, 13 Jan 2007 14:25:03 -0500
To: bug-CGI-Session [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
root via RT wrote: Show quoted text
> Queue: CGI-Session > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=24355 > > > Mark, do you think we can somehow avoid this missing handle problem, possibly by implementing it > through a singleton class, or any other way, so we can prevent early destruction of the handle? > Because if we can solve this problem, we will solve the problem of automatic flush(), I believe. > > Although, by now, I am not sure how important that is
At this point, I'm ready to quit relying on automatic flushing. Manual flushing would also avoid this DB handle issue. I myself managed to create a circular reference that prevented the object destruction to happen at the expected time, and it seems others have also stumbled upon ways to make automatic flushing unreliable. In my view, the reason to keep the supporting it is backwards compatibility. When used in the context of a larger framework, there are ways to make flushing automatic anyway, such as calling it in a "teardown" phase of the request cycle. I believe this is what the CGI::Application for CGI::Session does. This approach can always be made to be safe, I think. Mark -- http://mark.stosberg.com/
Ron Savage reported this is fixed in our code repo. Mark