Subject: | Segfault in apache2-mpm-prefork v2.2.22, mod_perl, perl v5.14.2 |
Date: | Tue, 23 Apr 2013 09:45:09 -0400 |
To: | bug-devel-nytprof [...] rt.cpan.org |
From: | Stephen Oberholtzer <stevie [...] qrpff.net> |
I'm not yet certain whose fault this is, but I'm submitting this anyway so
that someone else knows.
First: When I try to use Devel::NYTProf::Apache on my system, Apache
segfaults immediately on startup.
First, the numbers:
Debian wheezy (and all the debian patches that comes with)
Perl v5.14.2 (Debian version 5.14.2-20)
Apache2-mpm-prefork v2.2.22 (Debian version 2.2.22-13)
Devel::NYTProf 4.06
I have attempted to track down the problem, and narrowed it down to this
sequence of events:
1. Apache starts up and spins up mod_perl
2. mod_perl creates an interpreter
3. Devel::NYTProf is loaded. XS_DB_init_profiler patches the opcode table.
4. Apache decides to shut down mod_perl for some reason.
5. mod_perl unloads all the SOs loaded, including Devel::NYTProf
#5 0x00007ffff695800f in dlclose () from /lib/x86_64-linux-gnu/libdl.so.2
#6 0x00007ffff46be9f9 in modperl_sys_dlclose (handle=<optimized out>) at
modperl_sys.c:50
#7 0x00007ffff46b5b39 in modperl_xs_dl_handles_close
(handles=0x55555580a570) at modperl_util.c:319
#8 0x00007ffff46adea6 in modperl_interp_destroy (interp=0x555555806b10) at
modperl_interp.c:148
#9 0x00007ffff46adf19 in modperl_interp_pool_destroy (data=0x7ffff7e2e4c0)
at modperl_interp.c:202
#10 0x00007ffff7761957 in ?? () from /usr/lib/libapr-1.so.0
#11 0x00007ffff77607e9 in apr_pool_destroy () from /usr/lib/libapr-1.so.0
#12 0x00007ffff77606b7 in apr_pool_clear () from /usr/lib/libapr-1.so.0
#13 0x000055555558570f in main (argc=6, argv=0x7fffffffe618) at main.c:698
However, the Perl SO is not unloaded, and the opcode table remains patched.
6. Later (not much), a new interpreter is spun up
7. Perl goes to run some code and jumps to the address where NYTProf opcode
intercept functions were running
8. Those functions are no longer there, because the SO has been unloaded,
and segfault.
At this point I have not yet been able to determine if the problem is
mod_perl's (for not cleaning up the interpreter correctly) or NYTProf's
(for not cleaning up the opcode table before the interpreter is destroyed).
-- Stevie-O
Real programmers use COPY CON PROGRAM.EXE