Skip Menu |
 

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 19474
Status: rejected
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: ben.cornett [...] gmail.com
Cc:
AdminCc:

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



Subject: invalid resultset when generating schema is out of scope
Download (untitled) / with headers
text/plain 607b
Hi, Something seems to have changed between 0.06002 and 0.06003. Previously I had been writing code like this: sub foo { my $schema = My::DB->connect( 'dbi:SQLite:foo.db' ); return $schema->resultset('Baz')->search; } my $rs = foo(); This no longer seems to work in 0.06003. I get error messages like this Can't call method "storage" on an undefined value at /usr/lib/perl5/site_perl/5.8.8/DBIx/Class/ResultSource.pm line 304 The problem seems to be that ResultSets no longer work properly if the schema that generated them has gone out of scope. This wasn't the case in 0.06002 Thanks, Ben
Download (untitled) / with headers
text/plain 472b
On Thu May 25 09:59:49 2006, guest wrote: Show quoted text
> The problem seems to be that ResultSets no longer work properly if the > schema that generated them has gone out of scope. This wasn't the case > in 0.06002 >
I'm pretty sure that this has to do with this entry from the 0.06003 Changes file: "added memory cycle tests and a long-needed weaken call". It is perhaps possible that we need to move the weaken to elsewhere in the circular reference cycle to avoid this problem...
Download (untitled) / with headers
text/plain 1017b
On Thu May 25 09:59:49 2006, guest wrote: Show quoted text
> Hi, > > Something seems to have changed between 0.06002 and 0.06003. Previously > I had been writing code like this: > > sub foo { > my $schema = My::DB->connect( 'dbi:SQLite:foo.db' ); > return $schema->resultset('Baz')->search; > } > > my $rs = foo(); > > This no longer seems to work in 0.06003. I get error messages like this > > Can't call method "storage" on an undefined value at > /usr/lib/perl5/site_perl/5.8.8/DBIx/Class/ResultSource.pm line 304 > > > The problem seems to be that ResultSets no longer work properly if the > schema that generated them has gone out of scope. This wasn't the case > in 0.06002
Pending us coming up with a better answer, the current one is "don't do that anymore" since the alternative is a memory leak and DBI connections remaining open, which is far, far worse in the majority of cases. If you have any suggestions as to how to make this saner without re-introducing the leak, please follow up to the mailing list.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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