Skip Menu |

This queue is for tickets about the CHI-Driver-BerkeleyDB CPAN distribution.

Report information
The Basics
Id: 105207
Status: open
Priority: 0/
Queue: CHI-Driver-BerkeleyDB

People
Owner: Nobody in particular
Requestors: NHORNE [...] cpan.org
Cc:
AdminCc:

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



Subject: Driver Close
When does the driver close the database? I have a destructor called by END not DESTROY which fails because the database is "already closed". How do I force CHI to be closed/unloaded afterwards?
Subject: Driver Close
When does the driver close the database? I have a destructor called by END not DESTROY which fails because the database is "already closed". How do I force CHI to be closed/unloaded afterwards?
Subject: Re: [rt.cpan.org #105207] Driver Close
Date: Sat, 13 Jun 2015 05:32:00 -0700
To: bug-CHI-Driver-BerkeleyDB [...] rt.cpan.org
From: Jonathan Swartz <swartz [...] pobox.com>
When the CHI handle is destroyed, its dbh will be destroyed as well. You could try keeping a global reference to $cache->dbh somewhere, that might prevent it from being destroyed: $global_dbh = $cache->dbh On Jun 13, 2015, at 5:26 AM, Nigel Horne via RT <bug-CHI-Driver-BerkeleyDB@rt.cpan.org> wrote: Show quoted text
> Sat Jun 13 08:26:26 2015: Request 105207 was acted upon. > Transaction: Ticket created by NHORNE > Queue: CHI-Driver-BerkeleyDB > Subject: Driver Close > Broken in: 0.02 > Severity: Important > Owner: Nobody > Requestors: NHORNE@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=105207 > > > > When does the driver close the database? I have a destructor called by END not DESTROY which fails because the database is "already closed". How do I force CHI to be closed/unloaded afterwards?
Subject: Re: [rt.cpan.org #105207] Driver Close
Date: Mon, 15 Jun 2015 12:24:37 -0400
To: <bug-CHI-Driver-BerkeleyDB [...] rt.cpan.org>
From: Nigel Horne <njh [...] bandsman.co.uk>
What causes the handle to be destroyed? It's certainly still in scope when my destructor is being called. -Nigel Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=105207 > > > When the CHI handle is destroyed, its dbh will be destroyed as well. You could try keeping a global reference to $cache->dbh somewhere, that might prevent it from being destroyed: > > $global_dbh = $cache->dbh > > On Jun 13, 2015, at 5:26 AM, Nigel Horne via RT <bug-CHI-Driver-BerkeleyDB@rt.cpan.org> wrote: >
Download smime.p7s
application/pkcs7-signature 4.1k

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #105207] Driver Close
Date: Mon, 15 Jun 2015 10:22:07 -0700
To: bug-CHI-Driver-BerkeleyDB [...] rt.cpan.org
From: Jonathan Swartz <swartz [...] pobox.com>
I thought you said it was an END block. On Jun 15, 2015, at 9:41 AM, njh@bandsman.co.uk via RT <bug-CHI-Driver-BerkeleyDB@rt.cpan.org> wrote: Show quoted text
> Queue: CHI-Driver-BerkeleyDB > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=105207 > > > What causes the handle to be destroyed? It's certainly still in scope > when my destructor is being called. > > -Nigel
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=105207 > >> >> When the CHI handle is destroyed, its dbh will be destroyed as well. You could try keeping a global reference to $cache->dbh somewhere, that might prevent it from being destroyed: >> >> $global_dbh = $cache->dbh >> >> On Jun 13, 2015, at 5:26 AM, Nigel Horne via RT <bug-CHI-Driver-BerkeleyDB@rt.cpan.org> wrote: >>
> > > <smime.p7s>
Subject: Re: [rt.cpan.org #105207] Driver Close
Date: Mon, 15 Jun 2015 13:27:04 -0400
To: <bug-CHI-Driver-BerkeleyDB [...] rt.cpan.org>
From: Nigel Horne <njh [...] bandsman.co.uk>
It is. N Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=105207 > > > I thought you said it was an END block. > > On Jun 15, 2015, at 9:41 AM, njh@bandsman.co.uk via RT <bug-CHI-Driver-BerkeleyDB@rt.cpan.org> wrote: >
>> Queue: CHI-Driver-BerkeleyDB >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=105207 > >> >> What causes the handle to be destroyed? It's certainly still in scope >> when my destructor is being called. >> >> -Nigel
>>> <URL: https://rt.cpan.org/Ticket/Display.html?id=105207 > >>> >>> When the CHI handle is destroyed, its dbh will be destroyed as well. You could try keeping a global reference to $cache->dbh somewhere, that might prevent it from being destroyed: >>> >>> $global_dbh = $cache->dbh >>> >>> On Jun 13, 2015, at 5:26 AM, Nigel Horne via RT <bug-CHI-Driver-BerkeleyDB@rt.cpan.org> wrote: >>>
>> >> <smime.p7s>
-- Nigel Horne Conductor: Rockville Brass Band, Washington Metropolitan GSO @nigelhorne | fb/nigel.horne | bandsman.co.uk | concert-bands.co.uk | www.nigelhorne.com Unless it's for my eyes only, please use "reply all"
Download smime.p7s
application/pkcs7-signature 4.1k

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #105207] Driver Close
Date: Mon, 15 Jun 2015 10:40:41 -0700
To: bug-CHI-Driver-BerkeleyDB [...] rt.cpan.org
From: Jonathan Swartz <swartz [...] pobox.com>
I thought that in an END block, everything gets destroyed. Maybe not. In that case, I don’t know…but CHI isn’t doing anything to explicitly close the database. On Jun 15, 2015, at 10:31 AM, njh@bandsman.co.uk via RT <bug-CHI-Driver-BerkeleyDB@rt.cpan.org> wrote: Show quoted text
> Queue: CHI-Driver-BerkeleyDB > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=105207 > > > It is. > > N
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=105207 > >> >> I thought you said it was an END block. >> >> On Jun 15, 2015, at 9:41 AM, njh@bandsman.co.uk via RT <bug-CHI-Driver-BerkeleyDB@rt.cpan.org> wrote: >>
>>> Queue: CHI-Driver-BerkeleyDB >>> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=105207 > >>> >>> What causes the handle to be destroyed? It's certainly still in scope >>> when my destructor is being called. >>> >>> -Nigel
>>>> <URL: https://rt.cpan.org/Ticket/Display.html?id=105207 > >>>> >>>> When the CHI handle is destroyed, its dbh will be destroyed as well. You could try keeping a global reference to $cache->dbh somewhere, that might prevent it from being destroyed: >>>> >>>> $global_dbh = $cache->dbh >>>> >>>> On Jun 13, 2015, at 5:26 AM, Nigel Horne via RT <bug-CHI-Driver-BerkeleyDB@rt.cpan.org> wrote: >>>>
>>> >>> <smime.p7s>
> > > -- > Nigel Horne > Conductor: Rockville Brass Band, Washington Metropolitan GSO > @nigelhorne | fb/nigel.horne | bandsman.co.uk | concert-bands.co.uk | www.nigelhorne.com > > Unless it's for my eyes only, please use "reply all" > > > > <smime.p7s>
Show quoted text
> >>>> $global_dbh = $cache->dbh
I tried that, but got Can't locate object method "dbh" via package "CHI::Driver::BerkeleyDB__WITH__CHI::Driver::Role::Universal" -Nigel
Subject: Re: [rt.cpan.org #105207] Driver Close
Date: Tue, 16 Jun 2015 09:20:35 -0700
To: bug-CHI-Driver-BerkeleyDB [...] rt.cpan.org
From: Jonathan Swartz <swartz [...] pobox.com>
Sorry, I meant $global_db = $cache->db On Jun 16, 2015, at 7:27 AM, Nigel Horne via RT <bug-CHI-Driver-BerkeleyDB@rt.cpan.org> wrote: Show quoted text
> Queue: CHI-Driver-BerkeleyDB > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=105207 > >
>>>>>> $global_dbh = $cache->dbh
> > I tried that, but got > > Can't locate object method "dbh" via package "CHI::Driver::BerkeleyDB__WITH__CHI::Driver::Role::Universal" > > -Nigel
I believe that I now have a work around in place. It's not the same as yours, but is inspired by it. I would prefer not to have to do it, but it works for now. The fix is basically: my $cache = CHI->new(.....); foo($cache) Whereas I used to have, what I consider a neater option of: foo(CHI->new(....));