Generating report for mod_perl profile data

14 views
Skip to first unread message

hha...@hotmail.com

unread,
Sep 17, 2008, 6:56:39 AM9/17/08
to Devel::NYTProf Dev
I am trying to use NYTProf for profiling my mod_perl cgi-scripts, but
I have run into a problem. Maybe the developers group can tell me, if
I am not using NYTProf correctly?

I am using perl 5.8.8.

I have added the following lines to my Apache 2.2.3 mod_perl
konfiguration file:

PerlModule Devel::NYTProf::Apache
MaxClients 1

When I restart the mod_perl server, nytprof-files show up in /tmp. I
make a few requests and stop the mod_perl server.

[root@bongo ~]# ls -lrt /tmp/nytprof*
-rw-r--r-- 1 apache apache 1365345 Sep 15 10:01 /tmp/nytprof.32260.out.
32262
-rw-r--r-- 1 root root 2532 Sep 15 10:01 /tmp/nytprof.32260.out
-rw-r--r-- 1 root root 7227 Sep 15 10:01 /tmp/nytprof.32258.out

This far, everything seems to work.

But when I try to generate a HTML-report using one of the output
files, I get an error:

[root@bongo ~]# nytprofhtml -f /tmp/nytprof.32260.out.32262
Generating report...
Segmentation fault

If I stop the server without making any requests, the result is a bit
different:

[root@bongo tmp]# nytprofhtml -f nytprof.24163.out.24165
Generating report...
Unable to open '(eval 2)' for reading: No such file or directory. Try
running /usr/bin/nytprofhtml in the same directory as you ran
Devel::NYTProf, or ensure @INC is correct.
Unable to open '-e' for reading: No such file or directory.

What am I doing wrong?

Tim Bunce

unread,
Sep 17, 2008, 5:28:38 PM9/17/08
to develnyt...@googlegroups.com
On Wed, Sep 17, 2008 at 03:56:39AM -0700, hha...@hotmail.com wrote:
>
> I am trying to use NYTProf for profiling my mod_perl cgi-scripts, but
> I have run into a problem. Maybe the developers group can tell me, if
> I am not using NYTProf correctly?
>
> I am using perl 5.8.8.

Perl 5.8.8 has some problems which may be affecting you.

Please try the (very latest) trunk:
http://code.google.com/p/perl-devel-nytprof/source/checkout
and set the NYTPROF env var to xsfile=0

> But when I try to generate a HTML-report using one of the output
> files, I get an error:
>
> [root@bongo ~]# nytprofhtml -f /tmp/nytprof.32260.out.32262
> Generating report...
> Segmentation fault

It would be a big help if you could get a stack trace from that core dump.

Tim.

hha...@hotmail.com

unread,
Sep 18, 2008, 4:19:47 AM9/18/08
to Devel::NYTProf Dev
On 17 Sep., 23:28, Tim Bunce <Tim.Bu...@pobox.com> wrote:
> Perl 5.8.8 has some problems which may be affecting you.
>
> Please try the (very latest) trunk:http://code.google.com/p/perl-devel-nytprof/source/checkout
> and set the NYTPROF env var to xsfile=0

I have installed the latest version of NYTProf and updated my mod_perl
konfiguration file to include the NYTPROF env variable:

Alias /cgihenrikdkjobindex/ /home/henrik/jobxx/cgi/
<Location /cgihenrikdkjobindex>
SetEnv JOBHOME /home/henrik/jobdk
SetEnv JOBXXHOME /home/henrik/jobxx
SetEnv USER jobdk
SetEnv DATABASE jobdk
SetEnv NYTPROF xsfile=0
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
Options ExecCGI
allow from all
SetEnv SITE jobindex
</Location>

>
> > But when I try to generate a HTML-report using one of the output
> > files, I get an error:
>
> > [root@bongo ~]# nytprofhtml -f /tmp/nytprof.32260.out.32262
> > Generating report...
> > Segmentation fault
>
> It would be a big help if you could get a stack trace from that core dump.

nytprofhtml still ends with a 'Segmentation fault'.

I have made a core dump and looked at it using gdb:

[root@bongo ~]# gdb perl core.23326
GNU gdb Red Hat Linux (6.5-37.el5_2.2rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux-gnu"...(no debugging
symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".


warning: Can't read pathname for load map: Input/output error.
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/
libperl.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/
libperl.so
Reading symbols from /lib/libresolv.so.2...(no debugging symbols
found)...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libnsl.so.1...(no debugging symbols
found)...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libdl.so.2...(no debugging symbols
found)...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libm.so.6...(no debugging symbols
found)...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libcrypt.so.1...
(no debugging symbols found)...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libutil.so.1...(no debugging symbols
found)...done.
Loaded symbols for /lib/libutil.so.1
Reading symbols from /lib/libpthread.so.0...(no debugging symbols
found)...done.
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/libc.so.6...(no debugging symbols
found)...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols
found)...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/
List/Util/Util.so...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/
List/Util/Util.so
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/
Cwd/Cwd.so...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/
Cwd/Cwd.so
Reading symbols from /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-
multi/Devel/auto/Devel/NYTProf/NYTProf.so...done.
Loaded symbols for /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-
multi/Devel/auto/Devel/NYTProf/NYTProf.so
Reading symbols from /lib/librt.so.1...done.
Loaded symbols for /lib/librt.so.1
Reading symbols from /usr/lib/libz.so.1...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/
File/Glob/Glob.so...done.
Loaded symbols for /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/
File/Glob/Glob.so

Core was generated by `perl /usr/bin/nytprofhtml -f /tmp/nytprof.
22665.out.22667'.
Program terminated with signal 11, Segmentation fault.
#0 0x0067781c in read_str (my_perl=0x9846008, sv=0x9bf0a14) at
NYTProf.xs:866
866 buf = SvPV_nolen(sv);
(gdb) bt
#0 0x0067781c in read_str (my_perl=0x9846008, sv=0x9bf0a14) at
NYTProf.xs:866
#1 0x006783a6 in XS_Devel__NYTProf__Data_load_profile_data_from_file
(my_perl=0x9846008, cv=0x996653c) at NYTProf.xs:2606
#2 0x0045841d in Perl_pp_entersub () from /usr/lib/perl5/5.8.8/i386-
linux-thread-multi/CORE/libperl.so
#3 0x0045188f in Perl_runops_standard () from /usr/lib/perl5/5.8.8/
i386-linux-thread-multi/CORE/libperl.so
#4 0x003f710e in perl_run () from /usr/lib/perl5/5.8.8/i386-linux-
thread-multi/CORE/libperl.so
#5 0x0804921e in main ()
(gdb) print * sv
$1 = {sv_any = 0x0, sv_refcnt = 1, sv_flags = 67371008}

Thank you for your quick reply to my first message.

Henrik

Tim Bunce

unread,
Sep 18, 2008, 11:20:28 AM9/18/08
to hha...@hotmail.com, Devel::NYTProf Dev
On Thu, Sep 18, 2008 at 01:19:47AM -0700, hha...@hotmail.com wrote:
>
> On 17 Sep., 23:28, Tim Bunce <Tim.Bu...@pobox.com> wrote:
> > Perl 5.8.8 has some problems which may be affecting you.
> >
> > Please try the (very latest) trunk:http://code.google.com/p/perl-devel-nytprof/source/checkout
> > and set the NYTPROF env var to xsfile=0
>
> I have installed the latest version of NYTProf and updated my mod_perl
> konfiguration file to include the NYTPROF env variable:
>
> Alias /cgihenrikdkjobindex/ /home/henrik/jobxx/cgi/
> <Location /cgihenrikdkjobindex>
> SetEnv JOBHOME /home/henrik/jobdk
> SetEnv JOBXXHOME /home/henrik/jobxx
> SetEnv USER jobdk
> SetEnv DATABASE jobdk
> SetEnv NYTPROF xsfile=0

That wouldn't work because it happens too late. The env var must be set
when NYTProf is loaded.

> > > [root@bongo ~]# nytprofhtml -f /tmp/nytprof.32260.out.32262
> > > Generating report...
> > > Segmentation fault
> >
> > It would be a big help if you could get a stack trace from that core dump.
>

> I have made a core dump and looked at it using gdb:
>

> Core was generated by `perl /usr/bin/nytprofhtml -f /tmp/nytprof.
> 22665.out.22667'.


> Program terminated with signal 11, Segmentation fault.
> #0 0x0067781c in read_str (my_perl=0x9846008, sv=0x9bf0a14) at NYTProf.xs:866
> 866 buf = SvPV_nolen(sv);
> (gdb) bt
> #0 0x0067781c in read_str (my_perl=0x9846008, sv=0x9bf0a14) at NYTProf.xs:866
> #1 0x006783a6 in XS_Devel__NYTProf__Data_load_profile_data_from_file (my_perl=0x9846008, cv=0x996653c) at NYTProf.xs:2606

The read_str (my_perl=0x9846008, sv=0x9bf0a14) is puzzling because
the code at NYTProf.xs:2606 is read_str(aTHX_ NULL);
So the sv arg should be NULL. Perhaps it's shown not NULL in the stack
trace because it's been set when the core is dumped.

Please add
warn("read_str len %d sv %p", len sv);
near the top of read_str() and let us know what the last value printed
before the core dump is.

(How big is the nytprof .out file? Perhaps I could get a copy.)

> (gdb) print * sv
> $1 = {sv_any = 0x0, sv_refcnt = 1, sv_flags = 67371008}

Ah, I think I have a fix for this. Try the latest trunk.

Tim.

hha...@hotmail.com

unread,
Sep 19, 2008, 4:01:41 AM9/19/08
to Devel::NYTProf Dev
Setting the xsfile env variable correctly solved the problem - no
segmentation fault from nytprofhtml.

Thank you very much for your help.

Henrik
> Tim.- Skjul tekst i anførselstegn -
>
> - Vis tekst i anførselstegn -- Skjul tekst i anførselstegn -
>
> - Vis tekst i anførselstegn -

Tim Bunce

unread,
Sep 19, 2008, 10:00:13 AM9/19/08
to develnyt...@googlegroups.com, hha...@hotmail.com
On Fri, Sep 19, 2008 at 01:01:41AM -0700, hha...@hotmail.com wrote:
>
> Setting the xsfile env variable correctly solved the problem - no
> segmentation fault from nytprofhtml.
>
> Thank you very much for your help.

You're welcome, but you're not off the hook yet! :)

I still need your help to find the cause of the reader seg fault.

So this still applies:

> > > Core was generated by `perl /usr/bin/nytprofhtml -f /tmp/nytprof.
> > > 22665.out.22667'.
> > > Program terminated with signal 11, Segmentation fault.
> > > #0  0x0067781c in read_str (my_perl=0x9846008, sv=0x9bf0a14) at NYTProf.xs:866
> > > 866         buf = SvPV_nolen(sv);
> > > (gdb) bt
> > > #0  0x0067781c in read_str (my_perl=0x9846008, sv=0x9bf0a14) at NYTProf.xs:866
> > > #1  0x006783a6 in XS_Devel__NYTProf__Data_load_profile_data_from_file (my_perl=0x9846008, cv=0x996653c) at NYTProf.xs:2606
> >
> > The read_str (my_perl=0x9846008, sv=0x9bf0a14) is puzzling because
> > the code at NYTProf.xs:2606 is read_str(aTHX_ NULL);
> > So the sv arg should be NULL. Perhaps it's shown not NULL in the stack
> > trace because it's been set when the core is dumped.
> >
> > Please add
> >     warn("read_str len %d sv %p", len sv);
> > near the top of read_str() and let us know what the last value printed
> > before the core dump is.

Plus any other debugging you can think off to isolate the cause.

(How big is the nytprof .out file? Perhaps I could get a copy.)

Tim.

hha...@hotmail.com

unread,
Sep 22, 2008, 5:48:03 AM9/22/08
to Devel::NYTProf Dev
I have checked out the latest trunk today, removed the env var xsfile
and generated some profiling data.

This time nytprofhtml did not crash. It generated a report, that looks
fine.

So - am I off the hook now? :)

Henrik

Tim Bunce

unread,
Sep 22, 2008, 10:24:00 AM9/22/08
to develnyt...@googlegroups.com
On Mon, Sep 22, 2008 at 02:48:03AM -0700, hha...@hotmail.com wrote:
>
> I have checked out the latest trunk today, removed the env var xsfile
> and generated some profiling data.
>
> This time nytprofhtml did not crash. It generated a report, that looks
> fine.
>
> So - am I off the hook now? :)

No! :)

The reader side shouldn't seg fault on bad data. Can you feed the old
nytprof.out file (that seg faulted the old nytprofhtml) and see if that
still seg faults the current one?

Tim.

hha...@hotmail.com

unread,
Sep 23, 2008, 9:19:54 AM9/23/08
to Devel::NYTProf Dev
I deleted the old profile data files, so I can't check if the new
nytprofhtml will crash on those files.

Henrik

Tim Bunce

unread,
Sep 23, 2008, 11:14:03 AM9/23/08
to develnyt...@googlegroups.com, hha...@hotmail.com
Could you try installing an old version of NYTProf and re-profiling with that?

Tim.

hha...@hotmail.com

unread,
Sep 24, 2008, 7:08:14 AM9/24/08
to Devel::NYTProf Dev
If you tell me how to do that.

I have used the following command so far:

svn checkout http://perl-devel-nytprof.googlecode.com/svn/trunk/
nytprof

Henrik

Tim Bunce

unread,
Sep 24, 2008, 9:27:48 AM9/24/08
to develnyt...@googlegroups.com
On Wed, Sep 24, 2008 at 04:08:14AM -0700, hha...@hotmail.com wrote:
>
> If you tell me how to do that.

Thanks.

> I have used the following command so far:
>
> svn checkout http://perl-devel-nytprof.googlecode.com/svn/trunk/
> nytprof

In a new separate directory you could
svn checkout http://perl-devel-nytprof.googlecode.com/svn/tags/2.03/
then build and install that (overwriting the currently installed newer one).

Generate the profile and get a core dump the same way you did before.

Then go back to your trunk directory and make install there (to overwite
the old version to ensure the new one gets used).

Then see if the nytprof.out still generates a core with the new version.
If it does then please send me a stack trace as before.
If it doesn't then you're off the hook :)

Tim.

hen...@jobindex.dk

unread,
Sep 25, 2008, 4:21:40 AM9/25/08
to Devel::NYTProf Dev
I checked out the old version of NYTProf:

svn checkout http://perl-devel-nytprof.googlecode.com/svn/tags/2.03/
nytprofold

and installed it.

I then generated some profile data and tried to generate a report.
This caused a segmentation fault - as expected.

Then I checked out the latest trunk of NYTProf:
and installed this version.

I then tried to generate a report using the new nytprofhtml and the
profile data generated with the old version of NYTProf.

This did not cause an error and the report look ok.

Henrik

On 24 Sep., 15:27, Tim Bunce <Tim.Bu...@pobox.com> wrote:
> On Wed, Sep 24, 2008 at 04:08:14AM -0700, hha...@hotmail.com wrote:
>
> > If you tell me how to do that.
>
> Thanks.
>
> > I have used the following command so far:
>
> > svn checkouthttp://perl-devel-nytprof.googlecode.com/svn/trunk/
> > nytprof
>
> In a new separate directory you could
>     svn checkouthttp://perl-devel-nytprof.googlecode.com/svn/tags/2.03/
> > > - Vis tekst i anførselstegn -- Skjul tekst i anførselstegn -

Tim Bunce

unread,
Sep 25, 2008, 5:35:07 AM9/25/08
to develnyt...@googlegroups.com
That's great. Thanks Henrik. You're off the hook now! :)

Tim.
Reply all
Reply to author
Forward
0 new messages