This queue is for tickets about the CHI CPAN distribution.

Report information
The Basics
Id:
79100
Status:
resolved
Priority:
Low/Low
Queue:

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

BugTracker
Severity:
Normal
Broken in:
0.55
Fixed in:
(no value)



Subject: CHI::Test
The tests in CHI::Test don't clean up after themselves. Is there a way to say "I've finished testing now delete all resources I used?" Perhaps at least calling clear() on each namespace used during the tests would be start, though not a complete solution.
Subject: Re: [rt.cpan.org #79100] CHI::Test
Date: Mon, 20 Aug 2012 04:17:58 -0700
To: bug-CHI@rt.cpan.org
From: Jonathan Swartz <swartz@pobox.com>
CHI::t::Driver::{File,FastMmap,CacheCache,DBI,BerkeleyDB} make use of tempdir() to clean themselves itself up when the process dies. And of course CHI::t::Driver::{Memory,RawMemory} need no cleanup. So I think the only backend whose test doesn't clean itself up is Memcached. It reads and writes from a running port, when it should probably start up memcached on a new port and kill it when done. So is your concern limited to Memcached, or is there another driver that I'm thinking of? (Or a driver that you are implementing)? Thanks Jon On Aug 20, 2012, at 1:01 AM, Nigel Horne via RT wrote:
Show quoted text
> Mon Aug 20 04:01:34 2012: Request 79100 was acted upon. > Transaction: Ticket created by NHORNE > Queue: CHI > Subject: CHI::Test > Broken in: 0.55 > Severity: Normal > Owner: Nobody > Requestors: NHORNE@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=79100 > > > > The tests in CHI::Test don't clean up after themselves. Is there a way > to say "I've finished testing now delete all resources I used?" Perhaps > at least calling clear() on each namespace used during the tests would > be start, though not a complete solution.
Subject: Re: [rt.cpan.org #79100] CHI::Test
Date: Mon, 20 Aug 2012 13:13:09 +0100
To: bug-CHI@rt.cpan.org
From: Nigel Horne <njh@bandsman.co.uk>
On 20/08/12 12:18, Jonathan Swartz via RT wrote:
Show quoted text
> > CHI::t::Driver::{File,FastMmap,CacheCache,DBI,BerkeleyDB} make use of tempdir() to clean themselves itself up when the process dies. And of course CHI::t::Driver::{Memory,RawMemory} need no cleanup. > > So I think the only backend whose test doesn't clean itself up is Memcached. It reads and writes from a running port, when it should probably start up memcached on a new port and kill it when done. > > So is your concern limited to Memcached, or is there another driver that I'm thinking of? (Or a driver that you are implementing)?
It's a driver I've implemented. -Nigel
Subject: Re: [rt.cpan.org #79100] CHI::Test
Date: Mon, 20 Aug 2012 07:22:09 -0700
To: bug-CHI@rt.cpan.org
From: Jonathan Swartz <swartz@pobox.com>
On Aug 20, 2012, at 5:13 AM, njh@bandsman.co.uk via RT wrote:
Show quoted text
> Queue: CHI > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=79100 > > > On 20/08/12 12:18, Jonathan Swartz via RT wrote:
>> >> CHI::t::Driver::{File,FastMmap,CacheCache,DBI,BerkeleyDB} make use of tempdir() to clean themselves itself up when the process dies. And of course CHI::t::Driver::{Memory,RawMemory} need no cleanup. >> >> So I think the only backend whose test doesn't clean itself up is Memcached. It reads and writes from a running port, when it should probably start up memcached on a new port and kill it when done. >> >> So is your concern limited to Memcached, or is there another driver that I'm thinking of? (Or a driver that you are implementing)?
> > It's a driver I've implemented. > -Nigel >
Ok, could you be more specific about your driver? Is there a way that the cleanup could be built into the backend itself (the way we do with tempdir()), rather than trying to go through and clear all namespaces, etc.?
Subject: Re: [rt.cpan.org #79100] CHI::Test
Date: Mon, 20 Aug 2012 15:26:16 +0100
To: bug-CHI@rt.cpan.org
From: Nigel Horne <njh@bandsman.co.uk>
Show quoted text
> Ok, could you be more specific about your driver? Is there a way that the cleanup could be built into the backend itself (the way we do with tempdir()), rather than trying to go through and clear all namespaces, etc.?
See CHI::Driver::SharedMem for more information. -Nigel
Subject: Re: [rt.cpan.org #79100] CHI::Test
Date: Mon, 20 Aug 2012 10:11:36 -0700
To: bug-CHI@rt.cpan.org
From: Jonathan Swartz <swartz@pobox.com>
On Aug 20, 2012, at 7:26 AM, njh@bandsman.co.uk via RT wrote:
Show quoted text
> Queue: CHI > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=79100 > > >
>> Ok, could you be more specific about your driver? Is there a way that the cleanup could be built into the backend itself (the way we do with tempdir()), rather than trying to go through and clear all namespaces, etc.?
> > See CHI::Driver::SharedMem for more information. >
Ok. So I think you want to do the equivalent of what the other modules do with tempdir(), that is, create a shared memory segment that is guaranteed to be cleaned up at the end of the process. I don't know much about shared memory but maybe something like: END { IPC::SharedMem->new(12344321, …)->remove(); } Of course there's nothing you can do in case of a kill -9, server crash, etc. I will add something to CHI::Driver::Development about how each driver test is responsible for cleaning up its backend. IMO arranging things so that the backend can be cleaned up in one go is much more likely to succeed than trying to remove all the namespaces and keys that were touched during the tests. Unrelated note: In your docs, looks like you need to format this section for code: Number of bytes in the cache [ int ] 'cache' => { 'namespace1' => { 'key1' => 'value1', 'key2' -> 'value2', ... } 'namespace2' => { 'key1' => 'value3', 'key3' => 'value2', ... } … } e.g. see how it displays on https://metacpan.org/module/CHI::Driver::SharedMem Best Jon
Subject: Re: [rt.cpan.org #79100] CHI::Test
Date: Mon, 20 Aug 2012 18:16:06 +0100
To: bug-CHI@rt.cpan.org
From: Nigel Horne <njh@bandsman.co.uk>
On 20/08/12 18:11, Jonathan Swartz via RT wrote:
Show quoted text
> > Ok. So I think you want to do the equivalent of what the other modules do with tempdir(), that is, create a shared memory segment that is guaranteed to be cleaned up at the end of the process. I don't know much about shared memory but maybe something like: > > END { IPC::SharedMem->new(12344321, …)->remove(); } > > Of course there's nothing you can do in case of a kill -9, server crash, etc. > > I will add something to CHI::Driver::Development about how each driver test is responsible for cleaning up its backend.
Great - that would help a lot thanks.
Show quoted text
> > IMO arranging things so that the backend can be cleaned up in one go is much more likely to succeed than trying to remove all the namespaces and keys that were touched during the tests. > > Unrelated note: In your docs, looks like you need to format this section for code: > > Number of bytes in the cache [ int ] 'cache' => { 'namespace1' => { 'key1' => 'value1', 'key2' -> 'value2', ... } 'namespace2' => { 'key1' => 'value3', 'key3' => 'value2', ... } … } > > e.g. see how it displays on https://metacpan.org/module/CHI::Driver::SharedMem
Yes - I did know that, I've already made a note in a FIXME note in the source.
Show quoted text
> > Best > Jon >

Message body not shown because it is not plain text.



This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.