i've been using the NYTProf plugin (very cool, and very useful! see ) but 
noticed something strange: some of my profiles include the (also very cool, 
and very useful!) "flame graph" but most don't. the ones that don't have an 
associated error message during the profile generation, something like this

Extracting subroutine call data ...
panic at /opt/perl5/perls/mojo5_perl/bin/nytprofcalls line 191.
Generating nytprof/html/nytprof_out_1421426644_103771_t3_31576/
all_stacks_by_time.calls failed


i'm using Mojolicious 5.72 and the latest cpan versions of 
Mojolicious::Plugin::NYTProf and Devel::NYTProf

after a lot of fiddling around trying to isolate this problem, i realized i 
never get the flame graph if my controller has an explicit call to render a 
template. i made a test case by adding a few lines to the "mojo generate 
app" example app:

in startup: 
   $self->plugin(NYTProf => {
      nytprof => {
        trace => 1,
        log => '/tmp/nytprof.log',
        pre_hook  => 'before_routes',
        post_hook => 'after_dispatch',
      },
    });


in the Example.pm controller:
sub t1 {
    my $self=shift;
    $self->render(text=>'ok t1');
}
sub t2 {
    my $self=shift; # implicit render example/t2.html.ep
}
sub t3 {
    my $self=shift;
    $self->render;  # explicit render example/t3.html.ep
}
sub t4 {
    my $self=shift;
    $self->render(template=>'example/t3');
}


i also defined trivial one-line templates for t2 and t3 and simple routes 
for /t1, etc.

when i profile these routes, i get the flame graph and no error messages on 
routes /t1 and /t2. i get the "all_stacks_by_time.calls failed" error 
message and no flame graph on /t3 and /t4

the big question is: *what's the difference between t2 and t3 ???*

i found a couple similar problems with non-mojo Devel::NYTProf over the 
years, and it seems to be related to the profiler not getting shut down 
gracefully. is there some reason why the after_dispatch hook is handled 
differently in t2 and t3?

i tried different post_hooks and various nytprof options but no dice. 

another weird thing: i can't duplicate this problem at all in a mojo lite 
app.

i'm going to file this as a bug on the plugin's github page, but i was 
wondering whether anyone here had any ideas what's going on, and especially 
any guesses on why routes t2 and t3 result in different profiler behavior.

thanks,
jay

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to