Skip Menu |

This queue is for tickets about the Catalyst-Runtime CPAN distribution.

Report information
The Basics
Id: 76437
Status: resolved
Priority: 0/
Queue: Catalyst-Runtime

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc: bobtfish [...] bobtfish.net
rafl [...] debian.org
nigel.metheringham [...] gmail.com
AdminCc:

Bug Information
Severity: Critical
Broken in: 5.90011
Fixed in: (no value)



Subject: Test failures with bleadperl (Can't use an undefined value as an ARRAY reference)
The t/live_app.t test fails with bleadperl. The matrix overview http://matrix.cpantesters.org/?dist=Catalyst-Authentication-Credential-HTTP-1.014 suggests that the failures started with 5.15.5 (the PASSes there are probably from systems where Test::WWW::Mechanize::Catalyst is not installed and the problematic test is skipped). A sample test report with a FAIL: http://www.cpantesters.org/cpan/report/5541ece2-80e5-11e1-a9f1-a8f3163997d5 Regards, Slaven
I'm building the stuff to look at this.
A maybe related failure in another Catalyst module: https://rt.cpan.org/Ticket/Display.html?id=76610 Regards, Slaven
RT-Send-CC: sprout [...] cpan.org
A bisect points to v5.15.4-401-gf45b078. Note that one more prerequisite must be met than the declared ones to produce the fail, Test::WWW::Mechanize::Catalyst must be there. In my case it is 0.57 for both perls. v5.15.4-400-g3973654 has all tests pass, v5.15.4-401-gf45b078 the cited diagnostics.
I tried adding this to t/live_app.t and running it with 5.14.2 and 5.15.9: BEGIN { *CORE::GLOBAL::bless = sub ($;$) { Carp'cluck join " ", caller if $_[1] eq 'AuthTestApp'; goto &CORE::bless } } The resulting backtraces differ at this point: 5.14.2: AuthTestApp::new('AuthTestApp', 'HASH(0xeea8c0)') called at /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011-wEvMJu/blib/lib/Catalyst.pm line 2024 Catalyst::prepare('AuthTestApp', 'env', 'HASH(0xf0e3e0)', 'response_cb', 'CODE(0xf0eab0)') called at /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011- wEvMJu/blib/lib/Catalyst.pm line 1986 5.15.9: Class::Accessor::new('AuthTestApp', 'HASH(0xf51870)') called at /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011-oJnh2Y/blib/lib/Catalyst.pm line 2029 Catalyst::prepare('AuthTestApp', 'env', 'HASH(0xf50fa0)', 'response_cb', 'CODE(0xf51420)') called at /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011- oJnh2Y/blib/lib/Catalyst.pm line 1991 The code in question seems to be this in Catalyst::prepare: # XXX # After the app/ctxt split, this should become an attribute based on something passed # into the application. $class->context_class( ref $class || $class ) unless $class->context_class; my $uploadtmp = $class->config->{uploadtmp}; my $c = $class->context_class->new({ $uploadtmp ? (_uploadtmp => $uploadtmp) : ()}); So apparently context_class is set incorrectly. I’ll keep digging.
On Wed Apr 18 11:30:46 2012, SPROUT wrote: Show quoted text
> I tried adding this to t/live_app.t and running it with 5.14.2 and > 5.15.9: > > BEGIN { *CORE::GLOBAL::bless = sub ($;$) { Carp'cluck join " ", caller > if $_[1] eq 'AuthTestApp'; > goto &CORE::bless } }
Except I had to use CORE::bless($_[0], @_ == 2 ? $_[1] : caller) on 5.14.2, rather than goto &CORE::bless, of course.
On Wed Apr 18 11:30:46 2012, SPROUT wrote: Show quoted text
> I tried adding this to t/live_app.t and running it with 5.14.2 and > 5.15.9: > > BEGIN { *CORE::GLOBAL::bless = sub ($;$) { Carp'cluck join " ", caller > if $_[1] eq 'AuthTestApp'; > goto &CORE::bless } } > > The resulting backtraces differ at this point: > > 5.14.2: > > AuthTestApp::new('AuthTestApp', 'HASH(0xeea8c0)') called at > /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011- > wEvMJu/blib/lib/Catalyst.pm line > 2024 > Catalyst::prepare('AuthTestApp', 'env', 'HASH(0xf0e3e0)', > 'response_cb', > 'CODE(0xf0eab0)') called at /Users/sprout/.cpan/build/Catalyst- > Runtime-5.90011- > wEvMJu/blib/lib/Catalyst.pm line 1986 > > 5.15.9: > > Class::Accessor::new('AuthTestApp', 'HASH(0xf51870)') called at > /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011- > oJnh2Y/blib/lib/Catalyst.pm line > 2029 > Catalyst::prepare('AuthTestApp', 'env', 'HASH(0xf50fa0)', > 'response_cb', > 'CODE(0xf51420)') called at /Users/sprout/.cpan/build/Catalyst- > Runtime-5.90011- > oJnh2Y/blib/lib/Catalyst.pm line 1991 > > The code in question seems to be this in Catalyst::prepare: > > # XXX > # After the app/ctxt split, this should become an attribute based > on something passed > # into the application. > $class->context_class( ref $class || $class ) unless $class-
> >context_class;
> > my $uploadtmp = $class->config->{uploadtmp}; > my $c = $class->context_class->new({ $uploadtmp ? (_uploadtmp => > $uploadtmp) : ()}); > > So apparently context_class is set incorrectly. I’ll keep digging.
$class->context_class is AuthTestApp in both cases. So somehow AuthTestApp is getting its own new method under 5.14.2, but not 5.15.9. The mro is different, too: 5.14.2: AuthTestApp Catalyst::Plugin::Authentication Moose::Object Catalyst Catalyst::Component Catalyst::Controller MooseX::MethodAttributes::Inheritable 5.15.9: AuthTestApp Catalyst::Plugin::Authentication Class::Accessor::Fast Class::Accessor Catalyst Catalyst::Component Moose::Object Catalyst::Controller MooseX::MethodAttributes::Inheritable Which leads me here: DB<11> x \@Catalyst::Plugin::Authentication::ISA 0 ARRAY(0x241e020) 0 'Moose::Object' DB<10> x \@Catalyst::Plugin::Authentication::ISA 0 ARRAY(0x24f4580) 0 'Class::Accessor::Fast'
On Wed Apr 18 12:51:35 2012, SPROUT wrote: Show quoted text
> Which leads me here: >
5.14.2: Show quoted text
> DB<11> x \@Catalyst::Plugin::Authentication::ISA > 0 ARRAY(0x241e020) > 0 'Moose::Object' >
5.15.9: Show quoted text
> DB<10> x \@Catalyst::Plugin::Authentication::ISA > 0 ARRAY(0x24f4580) > 0 'Class::Accessor::Fast'
Next step: 5.14.2: DB<1> w @Catalyst::Plugin::Authentication::ISA DB<2> c Watchpoint 0: @Catalyst::Plugin::Authentication::ISA changed: old value: '' new value: 'Moose::Object' Class::MOP::Class::superclasses(/Users/sprout/.cpan/build/Moose-2.0403- yf4L1V/blib/lib/Class/MOP/Class.pm:948): 948: my $class = $self->name; DB<2> T . = Class::MOP::Class::superclasses(ref(Moose::Meta::Class), 'Moose::Object') called from file `/Users/sprout/.cpan/build/Moose-2.0403-yf4L1V/blib/lib/Moose/Meta/Class.pm' line 559 . = Moose::Meta::Class::superclasses(undef, 'Moose::Object') called from file `/Users/sprout/.cpan/build/Moose-2.0403-yf4L1V/blib/lib/Moose.pm' line 215 . = Moose::init_meta('Moose', 'for_class', 'Catalyst::Plugin::Authentication', 'metaclass', undef, 'meta_name', 'meta') called from file `/Users/sprout/.cpan/build/Moose-2.0403- yf4L1V/blib/lib/Moose/Exporter.pm' line 435 $ = Moose::Exporter::__ANON__[/Users/sprout/.cpan/build/Moose-2.0403- yf4L1V/blib/lib/Moose/Exporter.pm:468]('Moose') called from file `/Users/sprout/.cpan/build/Catalyst-Plugin-Authentication-0.10019- 5ySbKT/blib/lib/Catalyst/Plugin/Authentication.pm' line 3 $ = Catalyst::Plugin::Authentication::BEGIN() called from file `/Users/sprout/.cpan/build/Catalyst-Plugin-Authentication-0.10019- 5ySbKT/blib/lib/Catalyst/Plugin/Authentication.pm' line 3 ...snipped... 5.15.9: DB<1> w @Catalyst::Plugin::Authentication::ISA DB<2> c Watchpoint 0: @Catalyst::Plugin::Authentication::ISA changed: old value: '' new value: 'Class::Accessor::Fast' base::import(/usr/local/lib/perl5/5.15.9/base.pm:114): 114: if( defined $fields_base ) { DB<2> T . = base::import('base', 'Class::Accessor::Fast') called from file '/Users/sprout/.cpan/build/Catalyst-Plugin-Authentication-0.10018- 2pbKQy/blib/lib/Catalyst/Plugin/Authentication.pm' line 3 . = Catalyst::Plugin::Authentication::BEGIN() called from file '/Users/sprout/.cpan/build/Catalyst-Plugin-Authentication-0.10018- 2pbKQy/blib/lib/Catalyst/Plugin/Authentication.pm' line 3 ...snipped... Line 3 of Authentication.pm is ‘use Moose;’. This is getting interesting....
On Wed Apr 18 12:56:29 2012, SPROUT wrote: Show quoted text
> Line 3 of Authentication.pm is ‘use Moose;’. > > This is getting interesting....
Um, I was using two different version of Catalyst::Plugin::Authentication. Now I have to start from scratch.
On Wed Apr 18 11:30:46 2012, SPROUT wrote: Show quoted text
> I tried adding this to t/live_app.t and running it with 5.14.2 and > 5.15.9: > > BEGIN { *CORE::GLOBAL::bless = sub ($;$) { Carp'cluck join " ", caller > if $_[1] eq 'AuthTestApp'; > goto &CORE::bless } } > > The resulting backtraces differ at this point: > > 5.14.2: > > AuthTestApp::new('AuthTestApp', 'HASH(0xeea8c0)') called at > /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011- > wEvMJu/blib/lib/Catalyst.pm line > 2024 > Catalyst::prepare('AuthTestApp', 'env', 'HASH(0xf0e3e0)', > 'response_cb', > 'CODE(0xf0eab0)') called at /Users/sprout/.cpan/build/Catalyst- > Runtime-5.90011- > wEvMJu/blib/lib/Catalyst.pm line 1986 > > 5.15.9: > > Class::Accessor::new('AuthTestApp', 'HASH(0xf51870)') called at > /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011- > oJnh2Y/blib/lib/Catalyst.pm line > 2029 > Catalyst::prepare('AuthTestApp', 'env', 'HASH(0xf50fa0)', > 'response_cb', > 'CODE(0xf51420)') called at /Users/sprout/.cpan/build/Catalyst- > Runtime-5.90011- > oJnh2Y/blib/lib/Catalyst.pm line 1991
AHA!!! https://github.com/rafl/catalyst-runtime/blob/master/lib/Catalyst.pm#L1187 This is the culprit, I would guess. What happens is that we explicitly make the application class ("AuthTestApp") immutable at the end of compliation - which inlines a Moose constructor directly into AuthTestApp. If we don't do this, then the ->new method comes from Class::Accessor::Fast, which results in none of the Moose attributes getting their default values... I would guess that some change in blead is causing the scope hook to not fire in the same manor it used to / not fire at all, which is the cause of this fail.
On Wed Apr 18 13:21:16 2012, BOBTFISH wrote: Show quoted text
> On Wed Apr 18 11:30:46 2012, SPROUT wrote:
> > I tried adding this to t/live_app.t and running it with 5.14.2 and > > 5.15.9: > > > > BEGIN { *CORE::GLOBAL::bless = sub ($;$) { Carp'cluck join " ", caller > > if $_[1] eq 'AuthTestApp'; > > goto &CORE::bless } } > > > > The resulting backtraces differ at this point: > > > > 5.14.2: > > > > AuthTestApp::new('AuthTestApp', 'HASH(0xeea8c0)') called at > > /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011- > > wEvMJu/blib/lib/Catalyst.pm line > > 2024 > > Catalyst::prepare('AuthTestApp', 'env', 'HASH(0xf0e3e0)', > > 'response_cb', > > 'CODE(0xf0eab0)') called at /Users/sprout/.cpan/build/Catalyst- > > Runtime-5.90011- > > wEvMJu/blib/lib/Catalyst.pm line 1986 > > > > 5.15.9: > > > > Class::Accessor::new('AuthTestApp', 'HASH(0xf51870)') called at > > /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011- > > oJnh2Y/blib/lib/Catalyst.pm line > > 2029 > > Catalyst::prepare('AuthTestApp', 'env', 'HASH(0xf50fa0)', > > 'response_cb', > > 'CODE(0xf51420)') called at /Users/sprout/.cpan/build/Catalyst- > > Runtime-5.90011- > > oJnh2Y/blib/lib/Catalyst.pm line 1991
> > AHA!!! > > https://github.com/rafl/catalyst-runtime/blob/master/lib/Catalyst.pm#L1187 > > This is the culprit, I would guess. > > What happens is that we explicitly make the application class > ("AuthTestApp") immutable at the end of compliation - which inlines a > Moose constructor directly into AuthTestApp. > > If we don't do this, then the ->new method comes from > Class::Accessor::Fast, which results in none of the Moose attributes > getting their default values... > > I would guess that some change in blead is causing the scope hook to not > fire in the same manor it used to / not fire at all, which is the cause > of this fail.
That on_scope_end fires when %^H is freed. The change that Andreas König cited (v5.15.4- 401-gf45b078) only makes the outer scope’s hint variables visible to a string eval’s run time (making eval 'strict->import' equivalent to eval { strict->import }, as it should be). So there must be a string eval somewhere within the same compilation scope that is causing %^H to get an extra refcount. I suppose I’d better keep digging.
On Wed Apr 18 16:22:03 2012, SPROUT wrote: Show quoted text
> On Wed Apr 18 13:21:16 2012, BOBTFISH wrote:
> > On Wed Apr 18 11:30:46 2012, SPROUT wrote:
> > > I tried adding this to t/live_app.t and running it with 5.14.2 and > > > 5.15.9: > > > > > > BEGIN { *CORE::GLOBAL::bless = sub ($;$) { Carp'cluck join " ",
> caller
> > > if $_[1] eq 'AuthTestApp'; > > > goto &CORE::bless } } > > > > > > The resulting backtraces differ at this point: > > > > > > 5.14.2: > > > > > > AuthTestApp::new('AuthTestApp', 'HASH(0xeea8c0)') called at > > > /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011- > > > wEvMJu/blib/lib/Catalyst.pm line > > > 2024 > > > Catalyst::prepare('AuthTestApp', 'env', 'HASH(0xf0e3e0)', > > > 'response_cb', > > > 'CODE(0xf0eab0)') called at /Users/sprout/.cpan/build/Catalyst- > > > Runtime-5.90011- > > > wEvMJu/blib/lib/Catalyst.pm line 1986 > > > > > > 5.15.9: > > > > > > Class::Accessor::new('AuthTestApp', 'HASH(0xf51870)') called at > > > /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011- > > > oJnh2Y/blib/lib/Catalyst.pm line > > > 2029 > > > Catalyst::prepare('AuthTestApp', 'env', 'HASH(0xf50fa0)', > > > 'response_cb', > > > 'CODE(0xf51420)') called at /Users/sprout/.cpan/build/Catalyst- > > > Runtime-5.90011- > > > oJnh2Y/blib/lib/Catalyst.pm line 1991
> > > > AHA!!! > > > > https://github.com/rafl/catalyst-
> runtime/blob/master/lib/Catalyst.pm#L1187
> > > > This is the culprit, I would guess. > > > > What happens is that we explicitly make the application class > > ("AuthTestApp") immutable at the end of compliation - which inlines
> a
> > Moose constructor directly into AuthTestApp. > > > > If we don't do this, then the ->new method comes from > > Class::Accessor::Fast, which results in none of the Moose attributes > > getting their default values... > > > > I would guess that some change in blead is causing the scope hook to
> not
> > fire in the same manor it used to / not fire at all, which is the
> cause
> > of this fail.
> > That on_scope_end fires when %^H is freed. The change that Andreas > König cited (v5.15.4- > 401-gf45b078) only makes the outer scope’s hint variables visible to a > string eval’s run time > (making eval 'strict->import' equivalent to eval { strict->import }, > as it should be). So there > must be a string eval somewhere within the same compilation scope that > is causing %^H to > get an extra refcount. > > I suppose I’d better keep digging.
With Catalyst::Plugin::Authentication version 0.10019 (but not 0.10018), I get a pass. But I would still like to get to the bottom of this.
On Wed Apr 18 16:30:06 2012, SPROUT wrote: Show quoted text
> On Wed Apr 18 16:22:03 2012, SPROUT wrote:
> > On Wed Apr 18 13:21:16 2012, BOBTFISH wrote:
> > > AHA!!! > > > > > > https://github.com/rafl/catalyst-
> > runtime/blob/master/lib/Catalyst.pm#L1187
> > > > > > This is the culprit, I would guess. > > > > > > What happens is that we explicitly make the application class > > > ("AuthTestApp") immutable at the end of compliation - which
> inlines
> > a
> > > Moose constructor directly into AuthTestApp. > > > > > > If we don't do this, then the ->new method comes from > > > Class::Accessor::Fast, which results in none of the Moose
> attributes
> > > getting their default values... > > > > > > I would guess that some change in blead is causing the scope hook
> to
> > not
> > > fire in the same manor it used to / not fire at all, which is the
> > cause
> > > of this fail.
> > > > That on_scope_end fires when %^H is freed. The change that Andreas > > König cited (v5.15.4- > > 401-gf45b078) only makes the outer scope’s hint variables visible to
> a
> > string eval’s run time > > (making eval 'strict->import' equivalent to eval { strict->import }, > > as it should be). So there > > must be a string eval somewhere within the same compilation scope
> that
> > is causing %^H to > > get an extra refcount. > > > > I suppose I’d better keep digging.
> > With Catalyst::Plugin::Authentication version 0.10019 (but not > 0.10018), I get a pass. But I > would still like to get to the bottom of this.
AuthTestApp.pm is defined like this: __BEGIN__ package AuthTestApp; use Catalyst qw/ Authentication /; our %users; __PACKAGE__->config( 'Plugin::Authentication' => { default_realm => 'test', test => { store => { class => 'Minimal', users => \%users, }, credential => { class => 'HTTP', type => 'basic', password_type => 'clear', password_field => 'password' }, }, }, ); %users = ( foo => { password => "s3cr3t", }, ); __PACKAGE__->setup; 1; __END__ Catalyst sets up the code in question to run on_scope_end. That means the end of the code that is currently compiling. When this test app calls __PACKAGE__->setup, it has already finished compiling, so it is no longer the currently-compiling code. live_app.t calls this (indirectly) from the main program, outside of any BEGIN block, like this: my $mech = Test::WWW::Mechanize::Catalyst->new(catalyst_app => 'AuthTestApp'); So, since no code is compiling, %^H is never freed. The %^H that setup used to attach to, the one that existed for the sake of compiling AuthTestApp.pm, is now freed when AuthTestApp.pm finishing compiling, rather than when it finishes running. Either it is a mistake for Catalyst to assume that code is still being compiled somewhere, somehow, when setup is called. Or AuthTestApp should set things up inside a BEGIN block, so that setup is called while AuthTestApp.pm is still being compiled. I’m not a Catalyst user, so I can’t tell you whether what it is doing is sensible, but it doesn’t *feel* right to me, because setup *must* be called when there is a BEGIN block somewhere on the call stack.
On Wed Apr 18 17:16:55 2012, SPROUT wrote: Show quoted text
> I’m not a Catalyst user, so I can’t tell you whether what it is doing > is sensible, but it doesn’t > *feel* right to me, because setup *must* be called when there is a > BEGIN block somewhere on > the call stack.
I’ve reported this against Catalyst as bug #76675.
I've just perlbrew'd blead, and I can't reproduce this issue. spaceinvaders Catalyst-Plugin-Authentication [master]$ ~/perl5/perlbrew/perls/perl-blead/bin/prove -Ilib t/*.t t/04_authentication.t ............ ok t/05_password.t .................. ok t/06_user.t ...................... ok t/live_app.t ..................... ok t/live_app_realms.t .............. ok t/live_app_realms_compat.t ....... ok t/live_app_realms_progressive.t .. ok t/live_app_remote1.t ............. ok t/live_app_remote2.t ............. ok t/live_app_session.t ............. 1/? [error] Store claimed to have a restorable user, but restoration failed. Did you change the user's id_field? t/live_app_session.t ............. ok All tests successful. Files=10, Tests=115, 8 wallclock secs ( 0.08 usr 0.02 sys + 7.75 cusr 0.46 csys = 8.31 CPU) Result: PASS spaceinvaders Catalyst-Plugin-Authentication [master]$ ~/perl5/perlbrew/perls/perl-blead/bin/prove -V TAP::Harness v3.23 and Perl v5.15.9 spaceinvaders Catalyst-Plugin-Authentication [master]$ uname -a Darwin spaceinvaders.config 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64 i386
On Wed Apr 18 18:45:02 2012, BOBTFISH wrote: Show quoted text
> I've just perlbrew'd blead, and I can't reproduce this issue. > > spaceinvaders Catalyst-Plugin-Authentication [master]$ > ~/perl5/perlbrew/perls/perl-blead/bin/prove -Ilib t/*.t > t/04_authentication.t ............ ok > t/05_password.t .................. ok > t/06_user.t ...................... ok > t/live_app.t ..................... ok > t/live_app_realms.t .............. ok > t/live_app_realms_compat.t ....... ok > t/live_app_realms_progressive.t .. ok > t/live_app_remote1.t ............. ok > t/live_app_remote2.t ............. ok > t/live_app_session.t ............. 1/? [error] Store claimed to have a > restorable user, but restoration failed. Did you change the user's > id_field? > t/live_app_session.t ............. ok > All tests successful. > Files=10, Tests=115, 8 wallclock secs ( 0.08 usr 0.02 sys + 7.75 cusr > 0.46 csys = 8.31 CPU) > Result: PASS > spaceinvaders Catalyst-Plugin-Authentication [master]$ > ~/perl5/perlbrew/perls/perl-blead/bin/prove -V > TAP::Harness v3.23 and Perl v5.15.9 > spaceinvaders Catalyst-Plugin-Authentication [master]$ uname -a > Darwin spaceinvaders.config 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan > 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64 i386 >
As I mentioned earlier: Show quoted text
> With Catalyst::Plugin::Authentication version 0.10019 (but not 0.10018), I get a pass.
So changes in 0.10019 render that on_scope_end unnecessary. (It’s still not firing in blead.)
On Wed Apr 18 17:16:55 2012, SPROUT wrote: Show quoted text
> Catalyst sets up the code in question to run on_scope_end. That means > the end of the code > that is currently compiling.
Not true. You can (ab)use this at runtime to mean on block end. <snip entirely reasonable explanation> Show quoted text
> Either it is a mistake for Catalyst to assume that code is still being > compiled somewhere, > somehow, when setup is called. Or AuthTestApp should set things up > inside a BEGIN block, > so that setup is called while AuthTestApp.pm is still being compiled.
No, I'm afraid it's entirely deliberate misuse of a 'feature'. This misuse is now (entirely fairly!) broken with blead. The plan would be to conditionally replace this insanity with https://github.com/rafl/hook-endofruntime given an appropriately modern perl version to support that. However, I currently can't go anywhere - until I can reproduce - I'll retry in linux tomorrow (but if someone could confirm this still fails for them in blead as of now, that'd be nice). Thanks!
On Wed Apr 18 18:53:30 2012, BOBTFISH wrote: Show quoted text
> On Wed Apr 18 17:16:55 2012, SPROUT wrote:
> > Catalyst sets up the code in question to run on_scope_end. That means > > the end of the code > > that is currently compiling.
> > Not true. > > You can (ab)use this at runtime to mean on block end.
Um, I’ve read the source for B::Hooks::EndOfScope and the corresponding perl source. I know what I’m talking about. :-) In 5.16 on_scope_end ends up meaning end of the compile time of the block containing the currently-running BEGIN block. In earlier versions it means the same or the end of the current string eval’s run time, depending on whether BEGIN or eval "" is closer to the top of the call stack. Show quoted text
> > <snip entirely reasonable explanation> >
> > Either it is a mistake for Catalyst to assume that code is still being > > compiled somewhere, > > somehow, when setup is called. Or AuthTestApp should set things up > > inside a BEGIN block, > > so that setup is called while AuthTestApp.pm is still being compiled.
> > No, I'm afraid it's entirely deliberate misuse of a 'feature'. This > misuse is now (entirely fairly!) broken with blead. > > The plan would be to conditionally replace this insanity with > https://github.com/rafl/hook-endofruntime
Scope::Upper can already do that, if I understand both modules correctly (I just glanced at hook-endofruntime quickly). Show quoted text
> > given an appropriately modern perl version to support that. > > However, I currently can't go anywhere - until I can reproduce - I'll > retry in linux tomorrow (but if someone could confirm this still fails > for them in blead as of now, that'd be nice).
Use Catalyst::Plugin::Authentication version 0.10018.
Subject: Re: [rt.cpan.org #76437] Test failures with bleadperl (Can't use an undefined value as an ARRAY reference)
Date: Thu, 19 Apr 2012 08:13:39 +0100
To: bug-Catalyst-Authentication-Credential-HTTP [...] rt.cpan.org
From: Tomas Doran <bobtfish [...] bobtfish.net>
On 18 Apr 2012, at 23:52, Father Chrysostomos via RT wrote: Show quoted text
> Queue: Catalyst-Authentication-Credential-HTTP > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=76437 > > > On Wed Apr 18 18:45:02 2012, BOBTFISH wrote:
>> I've just perlbrew'd blead, and I can't reproduce this issue. >>
<snip> Show quoted text
> > As I mentioned earlier: >
>> With Catalyst::Plugin::Authentication version 0.10019 (but not 0.10018), I get a pass.
>
Ah, sorry - I'm being unclear. I already tested both versions (as I suspected the newest version would probably fix the issue), and I can't reproduce even with the older version either.. :( Show quoted text
> So changes in 0.10019 render that on_scope_end unnecessary. (It’s still not firing in bleed.)
Maybe in this plugin - but a whole chunk of other plugins are like this - it's a general problem. The on_scope_end thing only exists as fixing everything (including darkpan) was impossible.. Either way - I think I have a fix in Catalyst that removes this horrible hack - thanks for the detailed bug report which led me straight to it! For the record, my failing to reproduce with v0.10018: spaceinvaders Catalyst-Plugin-Authentication [(no branch)*]$ git checkout v0.10018 Previous HEAD position was ecb1afb... Version 0.10017 HEAD is now at afa31b0... Checking in changes prior to tagging of version 0.10018. spaceinvaders Catalyst-Plugin-Authentication [(no branch)*]$ /Users/t0m/perl5/perlbrew/perls/perl-blead/bin/perl Makefile.PL *** Module::AutoInstall version 1.05 *** Checking for Perl dependencies... [Core Features] - Test::More ...loaded. (0.98 >= 0.88) - Test::Exception ...loaded. (0.31) - Class::MOP ...loaded. (2.0403) - Moose ...loaded. (2.0403) - Catalyst::Runtime ...loaded. (5.90011) - Class::Inspector ...loaded. (1.27) - MRO::Compat ...loaded. (0.11) - Catalyst::Plugin::Session ...loaded. (0.34 >= 0.10) *** Module::AutoInstall configuration finished. Writing Makefile for Catalyst::Plugin::Authentication Writing MYMETA.yml and MYMETA.json spaceinvaders Catalyst-Plugin-Authentication [(no branch)*]$ makecp lib/Catalyst/Authentication/Realm/Progressive.pm blib/lib/Catalyst/Authentication/Realm/Progressive.pm cp lib/Catalyst/Authentication/User.pm blib/lib/Catalyst/Authentication/User.pm cp lib/Catalyst/Authentication/Store/Minimal.pm blib/lib/Catalyst/Authentication/Store/Minimal.pm cp lib/Catalyst/Plugin/Authentication/Store/Minimal.pm blib/lib/Catalyst/Plugin/Authentication/Store/Minimal.pm cp lib/Catalyst/Authentication/Store/Null.pm blib/lib/Catalyst/Authentication/Store/Null.pm cp lib/Catalyst/Authentication/Credential/Password.pm blib/lib/Catalyst/Authentication/Credential/Password.pm cp lib/Catalyst/Authentication/Realm/Compatibility.pm blib/lib/Catalyst/Authentication/Realm/Compatibility.pm cp lib/Catalyst/Plugin/Authentication.pm blib/lib/Catalyst/Plugin/Authentication.pm cp lib/Catalyst/Authentication/User/Hash.pm blib/lib/Catalyst/Authentication/User/Hash.pm cp lib/Catalyst/Authentication/Realm.pm blib/lib/Catalyst/Authentication/Realm.pm cp lib/Catalyst/Authentication/Credential/Remote.pm blib/lib/Catalyst/Authentication/Credential/Remote.pm cp lib/Catalyst/Plugin/Authentication/Internals.pod blib/lib/Catalyst/Plugin/Authentication/Internals.pod cp lib/Catalyst/Plugin/Authentication/Credential/Password.pm blib/lib/Catalyst/Plugin/Authentication/Credential/Password.pm cp lib/Catalyst/Plugin/Authentication/User/Hash.pm blib/lib/Catalyst/Plugin/Authentication/User/Hash.pm cp lib/Catalyst/Plugin/Authentication/User.pm blib/lib/Catalyst/Plugin/Authentication/User.pm cp lib/Catalyst/Authentication/Store.pod blib/lib/Catalyst/Authentication/Store.pod Manifying blib/man3/Catalyst::Authentication::Realm::Progressive.3 Manifying blib/man3/Catalyst::Authentication::Store::Minimal.3 Manifying blib/man3/Catalyst::Authentication::User.3 Manifying blib/man3/Catalyst::Plugin::Authentication::Store::Minimal.3 Manifying blib/man3/Catalyst::Authentication::Store::Null.3 Manifying blib/man3/Catalyst::Authentication::Credential::Password.3 Manifying blib/man3/Catalyst::Plugin::Authentication.3 Manifying blib/man3/Catalyst::Authentication::Realm::Compatibility.3 Manifying blib/man3/Catalyst::Authentication::User::Hash.3 Manifying blib/man3/Catalyst::Authentication::Realm.3 Manifying blib/man3/Catalyst::Authentication::Credential::Remote.3 Manifying blib/man3/Catalyst::Plugin::Authentication::Credential::Password.3 Manifying blib/man3/Catalyst::Plugin::Authentication::Internals.3 Manifying blib/man3/Catalyst::Plugin::Authentication::User::Hash.3 Manifying blib/man3/Catalyst::Plugin::Authentication::User.3 Manifying blib/man3/Catalyst::Authentication::Store.3 spaceinvaders Catalyst-Plugin-Authentication [(no branch)*]$ make test PERL_DL_NONLAZY=1 /Users/t0m/perl5/perlbrew/perls/perl-blead/bin/perl5.15.9 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/04_authentication.t t/05_password.t t/06_user.t t/live_app.t t/live_app_realms.t t/live_app_realms_compat.t t/live_app_realms_progressive.t t/live_app_remote1.t t/live_app_remote2.t t/live_app_session.t t/04_authentication.t ............ ok t/05_password.t .................. ok t/06_user.t ...................... ok t/live_app.t ..................... ok t/live_app_realms.t .............. ok t/live_app_realms_compat.t ....... ok t/live_app_realms_progressive.t .. ok t/live_app_remote1.t ............. ok t/live_app_remote2.t ............. ok t/live_app_session.t ............. 1/? [error] Store claimed to have a restorable user, but restoration failed. Did you change the user's id_field? t/live_app_session.t ............. ok All tests successful. Files=10, Tests=115, 9 wallclock secs ( 0.08 usr 0.03 sys + 7.70 cusr 0.52 csys = 8.33 CPU) Result: PASS
Subject: Re: [rt.cpan.org #76437] Test failures with bleadperl (Can't use an undefined value as an ARRAY reference)
Date: Thu, 19 Apr 2012 08:36:10 +0100
To: bug-Catalyst-Authentication-Credential-HTTP [...] rt.cpan.org
From: Tomas Doran <bobtfish [...] bobtfish.net>
On 19 Apr 2012, at 02:19, Father Chrysostomos via RT wrote: Show quoted text
> On Wed Apr 18 18:53:30 2012, BOBTFISH wrote:
>> On Wed Apr 18 17:16:55 2012, SPROUT wrote:
>>> Catalyst sets up the code in question to run on_scope_end. That means >>> the end of the code >>> that is currently compiling.
>> >> Not true. >> >> You can (ab)use this at runtime to mean on block end.
> > Um, I’ve read the source for B::Hooks::EndOfScope and the corresponding perl source. I know > what I’m talking about. :-)
Apologies for coming across as trying to correct you! That was not the intention - you've assuredly got a much better understanding of how this actually works, or doesn't work then me - I'm only noting the observed effects. Show quoted text
> In 5.16 on_scope_end ends up meaning end of the compile time of the block containing the > currently-running BEGIN block. > > In earlier versions it means the same or the end of the current string eval’s run time, > depending on whether BEGIN or eval "" is closer to the top of the call stack.
Can I trouble you to explain how/why then the hook fires in earlier perls ? As the explanation above implies to me that this would never have worked.… Show quoted text
> Scope::Upper can already do that, if I understand both modules correctly (I just glanced at > hook-endofruntime quickly).
Catalyst previously used Scope::Upper for this (at least briefly - I'm not sure it ever made it to a production release). However (if I remember correctly - which I may not do), it was too sensitive to block level changes (i.e. if you wrote { __PACKAGE__->setup } in your app, it'd fire at the end of the block, not end of file). I would guess that you're right, and that Hook::EndOfRuntime is likely to cause the same issues. I'd like to be confident we know about exactly why the B::Hooks::EOS stops working in blead (I believe rafl may have raised a perlbug for this, but I'm unsure the # - I've followed up with him, and I'll link it in when I know the # / if I'm right). I also have a branch in Catalyst which fixes this in a much less insane manor - by copying the Moose::Object::new method into each plugin as it's loaded - avoiding any possibility of the Class::Accessor(::Fast)? new method from being lowest in the inheritance hierarchy. This means that we no longer require any ::Hooks?:: module, so whilst a pretty gross hack - it's less completely insane and should be much more predictable in future. This, however, implies a significant slowdown for Catalyst apps which don't manually make themselves immutable - so I'm going to look into restoring the immutable behaviour at a later point (when the app is told to run, rather than at end of compile time) to correct this. In the worst case, even if this doesn't work out - I'm pretty confident we'll be able to ship a fixed version which doesn't rely on the fragile behaviour in the next few days. A million thank yous for the work you've put into investigating this and helping explain it here. I don't have the appropriate words to describe how extremely helpful and highly appreciated this assistance is! Cheers Tomas
RT-Send-CC: sprout [...] cpan.org
I've moved this to the Catalyst-Runtime queue, as this is a core Catalyst issue, and I've marked it as Critical.
There is a test t/plugin_new_method_backcompat.t which should test for this issue in the current Catalyst::Runtime dist. However I can't find any fail reports for this currently. I guess this is because the (simplified) test case doesn't reproduce the issue, but I can't attempt to verify as I've not managed to reproduce the failure in the authentication plugin yet (I'm clearly doing it wrong somehow).
On Thu Apr 19 03:36:31 2012, BOBTFISH wrote: Show quoted text
> > On 19 Apr 2012, at 02:19, Father Chrysostomos via RT wrote:
> > On Wed Apr 18 18:53:30 2012, BOBTFISH wrote:
> >> On Wed Apr 18 17:16:55 2012, SPROUT wrote:
> >>> Catalyst sets up the code in question to run on_scope_end. That
> means
> >>> the end of the code > >>> that is currently compiling.
> >> > >> Not true. > >> > >> You can (ab)use this at runtime to mean on block end.
> > > > Um, I’ve read the source for B::Hooks::EndOfScope and the
> corresponding perl source. I know
> > what I’m talking about. :-)
> > Apologies for coming across as trying to correct you! That was not the > intention - you've assuredly got a much better understanding of how > this actually works, or doesn't work then me - I'm only noting the > observed effects. >
> > In 5.16 on_scope_end ends up meaning end of the compile time of the
> block containing the
> > currently-running BEGIN block. > > > > In earlier versions it means the same or the end of the current
> string eval’s run time,
> > depending on whether BEGIN or eval "" is closer to the top of the
> call stack. > > Can I trouble you to explain how/why then the hook fires in earlier > perls ? As the explanation above implies to me that this would > never have worked.…
Don’t forget that a required file is a type of string eval. So string eval scope ends up meaning file scope in that case. Show quoted text
> > Scope::Upper can already do that, if I understand both modules
> correctly (I just glanced at
> > hook-endofruntime quickly).
> > Catalyst previously used Scope::Upper for this (at least briefly - I'm > not sure it ever made it to a production release). > > However (if I remember correctly - which I may not do), it was too > sensitive to block level changes (i.e. if you wrote { __PACKAGE__-
> >setup } in your app, it'd fire at the end of the block, not end of
> file). > > I would guess that you're right, and that Hook::EndOfRuntime is likely > to cause the same issues.
In either case, you can specify how many levels up to go. (caller $num)[7] can be used to determine which frame is a require(). Show quoted text
> I'd like to be confident we know about exactly why the B::Hooks::EOS > stops working in blead (I believe rafl may have raised a perlbug > for this, but I'm unsure the # - I've followed up with him, and > I'll link it in when I know the # / if I'm right).
It still works, but, as I said, it works for compile-time scopes, rather than compile-time + string-eval-run-time scopes. Show quoted text
> I also have a branch in Catalyst which fixes this in a much less > insane manor - by copying the Moose::Object::new method into each > plugin as it's loaded - avoiding any possibility of the > Class::Accessor(::Fast)? new method from being lowest in the > inheritance hierarchy. This means that we no longer require any > ::Hooks?:: module, so whilst a pretty gross hack - it's less > completely insane and should be much more predictable in future. > > This, however, implies a significant slowdown for Catalyst apps which > don't manually make themselves immutable - so I'm going to look > into restoring the immutable behaviour at a later point (when the > app is told to run, rather than at end of compile time) to correct > this. In the worst case, even if this doesn't work out - I'm pretty > confident we'll be able to ship a fixed version which doesn't rely > on the fragile behaviour in the next few days.
I don’t know enough about Moose or Catalyst to understand exactly what the fix-up is for here. So I cannot comment on that.
On Thu Apr 19 04:16:00 2012, BOBTFISH wrote: Show quoted text
> There is a test t/plugin_new_method_backcompat.t which should test for > this issue in the current Catalyst::Runtime dist. > > However I can't find any fail reports for this currently.
With the attached patch applied (which eliminates the implicit BEGIN block that was making things work), I get this: $ perl5.15.9 -Mblib t/plugin_new_method_backcompat.t 1..8 ok 1 - Can apply method modifier ok 2 - I am not immutable yet not ok 3 - Am immutable after use # Failed test 'Am immutable after use' # at t/plugin_new_method_backcompat.t line 19. [error] Caught exception in engine "Can't use an undefined value as an ARRAY reference at /Users/sprout/.cpan/build/Catalyst-Runtime-5.90011-oJnh2Y/blib/lib/Catalyst.pm line 1686." Can't call method "request" on an undefined value at /Users/sprout/.cpan/build/Plack- 0.9986-78hPcj/blib/lib/Plack/Test/MockHTTP.pm line 29. # Looks like you planned 8 tests but ran 3. # Looks like you failed 1 test of 3 run. # Looks like your test exited with 255 just after 3. Show quoted text
> I guess this is because the (simplified) test case doesn't reproduce the > issue, but I can't attempt to verify as I've not managed to reproduce > the failure in the authentication plugin yet (I'm clearly doing it wrong > somehow).
There are so many dependencies that I’ve given up trying to figure it out. At least we know the root cause now!
Subject: open_b9jAUjzS.txt
diff -rup Catalyst-Runtime-5.90011-oJnh2Y-orig/t/plugin_new_method_backcompat.t Catalyst-Runtime-5.90011-oJnh2Y/t/plugin_new_method_backcompat.t --- Catalyst-Runtime-5.90011-oJnh2Y-orig/t/plugin_new_method_backcompat.t 2012-04-19 10:00:37.000000000 -0700 +++ Catalyst-Runtime-5.90011-oJnh2Y/t/plugin_new_method_backcompat.t 2012-04-19 10:00:44.000000000 -0700 @@ -14,7 +14,8 @@ use Moose::Util qw/find_meta/; use FindBin; use lib "$FindBin::Bin/lib"; -use Catalyst::Test qw/TestAppPluginWithConstructor/; +require Catalyst::Test; +Catalyst::Test->import(qw/TestAppPluginWithConstructor/); ok find_meta('TestAppPluginWithConstructor')->is_immutable, 'Am immutable after use';
Subject: Re: [rt.cpan.org #76437] Test failures with bleadperl (Can't use an undefined value as an ARRAY reference)
Date: Thu, 19 Apr 2012 18:26:53 +0100
To: bug-Catalyst-Runtime [...] rt.cpan.org
From: Tomas Doran <bobtfish [...] bobtfish.net>
On 19 Apr 2012, at 17:40, Father Chrysostomos via RT wrote: Show quoted text
>> Can I trouble you to explain how/why then the hook fires in earlier >> perls ? As the explanation above implies to me that this would >> never have worked.…
> > Don’t forget that a required file is a type of string eval. So string eval scope ends up > meaning file scope in that case.
Aha, illuminating! Thank you, I now understand :) Show quoted text
>> I'd like to be confident we know about exactly why the B::Hooks::EOS >> stops working in blead (I believe rafl may have raised a perlbug >> for this, but I'm unsure the # - I've followed up with him, and >> I'll link it in when I know the # / if I'm right).
> > It still works, but, as I said, it works for compile-time scopes, rather than compile-time + > string-eval-run-time scopes.
Yep, got it now, thanks. Show quoted text
> I don’t know enough about Moose or Catalyst to understand exactly what the fix-up is for > here. So I cannot comment on that.
No worries - I've got plenty of people who know Moose/Catalyst to review, and I'm confident that this is a better (or at least less fragile) fix. Thanks for the help!
I have applied a fix for this to git master (38e43e6), which should become part of the next maintenance release once it's been reviewed (hopefully later this weekend)
On Sat May 05 09:06:28 2012, BOBTFISH wrote: Show quoted text
> I have applied a fix for this to git master (38e43e6), which should > become part of the next maintenance release once it's been reviewed > (hopefully later this weekend)
I don’t see that anywhere in github.com/rafl/catalyst-runtime. Am I looking in the wrong place?
From: KnowZeroX [...] yahoo.com
On Sat May 05 14:30:36 2012, SPROUT wrote: Show quoted text
> On Sat May 05 09:06:28 2012, BOBTFISH wrote:
> > I have applied a fix for this to git master (38e43e6), which should > > become part of the next maintenance release once it's been reviewed > > (hopefully later this weekend)
> > I don’t see that anywhere in github.com/rafl/catalyst-runtime. Am I > looking in the wrong place?
http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits/Catalyst- Runtime.git;a=summary
On Sat May 05 14:30:36 2012, SPROUT wrote: Show quoted text
> On Sat May 05 09:06:28 2012, BOBTFISH wrote:
> > I have applied a fix for this to git master (38e43e6), which should > > become part of the next maintenance release once it's been reviewed > > (hopefully later this weekend)
> > I don’t see that anywhere in github.com/rafl/catalyst-runtime. Am I > looking in the wrong place?
<sigh> The github mirroring for our org account broke with 'verify your ssh keys' thing after the security breach, and github support has been useless at helping us verify that they are correct. Sorry about this - it's an ongoing issue which we're aware of (and trying to deal with) - the canonical repos is in another comment (and the dist META.yml)
This looks fixed to me for a long time, closing -jnap On Sat May 05 14:42:51 2012, BOBTFISH wrote: Show quoted text
> On Sat May 05 14:30:36 2012, SPROUT wrote:
> > On Sat May 05 09:06:28 2012, BOBTFISH wrote:
> > > I have applied a fix for this to git master (38e43e6), which should > > > become part of the next maintenance release once it's been reviewed > > > (hopefully later this weekend)
> > > > I don’t see that anywhere in github.com/rafl/catalyst-runtime. Am I > > looking in the wrong place?
> > <sigh> > > The github mirroring for our org account broke with 'verify your ssh > keys' thing after the security breach, and github support has been > useless at helping us verify that they are correct. > > Sorry about this - it's an ongoing issue which we're aware of (and > trying to deal with) - the canonical repos is in another comment (and > the dist META.yml)