[Catalyst] Warnings when upgrading Catalyst

Ovid publiustemp-catalyst at yahoo.com
Tue Jun 23 16:03:44 GMT 2009


----- Original Message ----

> From: Tomas Doran <bobtfish at bobtfish.net>
> 
> On 22 Jun 2009, at 10:26, Ovid wrote:
> 
> > 
> > Nobody has a clue on this one?  I've no idea how the relative values get set 
> and I'm not looking forward to a long slog through the guts of Catalyst to 
> understand what's happening here :)
> 
> I'm guessing that Catalyst is (incorrectly) trying to collect stats for the 
> private actions, or something similar.
> 
> I'd recommend you bisect backwards through the various CPAN releases and find 
> where it was introduced.
> 
> There is a detailed changelog, and I'd guess any releases mentioning 'stats' are 
> worth testing either side of.
> 
> I guess you can get the issue down to a release, or maybe even a specific 
> revision (git bisect for the win!), without having to attack the Catalyst code 
> at all.
> 
> I'd also guess that you're seeing the warning due to something 'non-standard' 
> your app is doing with logging / stats collection in general. If that stuff is 
> easy to identify - try just extracting that, one controller and a simple test 
> out into a standalone test app.. Or branch and start removing your application 
> (shoot the model and views, remove the code from the controllers leaving just 
> the stubs etc) - shouldn't take long to get down to a minimal app..
> 
> Either way, I'd recommend trying to narrow down your issue with one or both of 
> these techniques, rather than randomly trawling through the cat-guts..

I had to randomly trawl through the cat-guts. Paring down our rather large application is not easy and I wasn't aware of a git repository for git bisect.  I *did* wind up downloading various CPAN releases and got it down to this:

5.7* distributions do not issue the warning.

5.8005_05 to 5.80002 were failing with:

  (Could not load class (PIPs) because : Can't call method "reverse" on an undefined 
  value at /home/ovid/pips_dev/work/Pips3/branches/rights_modeling/Catalyst-Runtime-5.80001/ \
  lib/Catalyst/DispatchType/Chained.pm line 115.)

Earlier 5.8* series were failing with various errors.

In short, it's been tough for me to nail down when the failure occurs because different versions of Catalyst have different dependencies and it's tough to grab all at once and set up a good environment.

In the meantime, the warning thrown by Catalyst->_stats_start_execute() still remains.  You mentioned a guess that it was trying to collect stats on private attributes and the check for that is the first line:

  return if ( ( $code->name =~ /^_.*/ )
        && ( !$c->config->{show_internal_actions} ) );

The $code->name when we get the warning is 'default', so I'm assuming it's not considered a private action.  When we get to the actual section of code which issues the warning (line 1561 in the cpan distribution)

        if ( my $parent = $c->stack->[-1] ) {
            $c->stats->profile(
                begin  => $action,
                parent => "$parent" . $c->counter->{"$parent"},  # 1561
                uid    => $uid,
            );
        }
        else {

            # forward with no caller may come from a plugin
            $c->stats->profile(
                begin => $action,
                uid   => $uid,
            );
        }

The $action is '-> /import/response/default' and we go to here from the sub Catalyst::Dispatcher::_do_forward() and it's the forwarding which triggers this bit of the stats profiling.  I just don't know enough about what is supposed to happen here to give better information.  Sorry for being so darned vague :(  

Note that if we check to see if $c->counter->{"$parent"} is defined (again, $parent stringifies to "api/v1/promotion/_ACTION", in case it's relevant) and if not, switch to the else {}, this warning will go away.  I don't know, however, if this is the right thing to do, particularly since I can't write a test for this.  Phooey.

Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6



More information about the Catalyst mailing list