Skip Menu |

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

Report information
The Basics
Id: 65131
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: tguevin [...] bluesocket.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.08127
Fixed in: 0.08191



Subject: END { $global_phase_destroy++ } clause breaks in speedy persistent perl
In this diff (between -$VERSION = '0.08124' and +$VERSION = '0.08127') , there is a block of text here, that breaks speedy perl implementations. To test the code, you write a simple script to run a derived Schema object. If you run this under speedy, it will run OK once, but not any subsequent times. under normal perl, it runs ok each time. As a workaround, I commented out the "END" block and it worked ok in speedy and normal perl. --- /alternative/usr/local/share/perl/5.10.1/DBIx/Class/Schema.pm 2011-01-11 05:08:05.000000000 -0500 +++ ./Schema.pm 2011-01-25 18:53:36.000000000 -0500 @@ -1372,6 +1379,29 @@ $self->class_mappings(\%map); } +{ + my $global_phase_destroy; + + #BREAKS-speedy END { $global_phase_destroy++ } + + sub DESTROY { + return if $global_phase_destroy; + + my $self = shift; + my $srcs = $self->source_registrations; + + for my $moniker (keys %$srcs) { + # find first source that is not about to be GCed (someone other than $self + # holds a reference to it) and reattach to it, weakening our own link + if (ref $srcs->{$moniker} and svref_2object($srcs->{$moniker})- Show quoted text
>REFCNT > 1) {
+ $srcs->{$moniker}->schema($self); + weaken $srcs->{$moniker}; + last; + } + } + } +} + Please make this code speedy/perperl compliant, as the version 0.08124 was. Thanks. perl -v This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi uname -a Linux vWLAN-80002509000003 2.6.32-21-generic-pae #32-Ubuntu SMP Fri Apr 16 09:39:35 UTC 2010 i686 GNU/Linux
On Tue Jan 25 19:19:54 2011, tomg wrote: Show quoted text
> In this diff (between -$VERSION = '0.08124' and +$VERSION = '0.08127') > , there is a block of text here, that breaks speedy perl > implementations. To test the code, you write a simple script to run a > derived Schema object. If you run this under speedy, it will run OK > once, but not any subsequent times. under normal perl, it runs ok each > time. As a workaround, I commented out the "END" block and it worked > ok in speedy and normal perl. >
Tests were added and the underlying condition fixed[1]. Will appear in the next release. In the meantime your workaround is sufficient, but note that you may get many weird warnings on perl shutdown. [1] http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/DBIx-Class.git;a=commitdiff;h=f4c9cd58d157da210f170649378e6496eccb481e
Fix released with 0.08191