简体   繁体   中英

Troubleshooting Math::PARI crash inside mod_perl

I build (brewed) my own perl, then the mod_perl module, and then installed all required perl libraries.

The mod_perl environment works fine. One-liners with Math::PARI also work, for example:

perl -MMath::Pari -e "use Math::Pari ':float', 'type_name'; warn type_name 22222222222222222222222;" t_INT at -e line 1.

However, when I start apache2/mod_perl and try to load Math::PARI I get the following crash:

root@paris:/usr/apps/test/config# gdb -q /usr/sbin/apache2
Reading symbols from /usr/sbin/apache2...(no debugging symbols found)...done.
(gdb) set args -f /usr/apps/test/config/httpd.conf -k start
(gdb) run
Starting program: /usr/sbin/apache2 -f /usr/apps/test/config/httpd.conf -k start
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff367bea7 in moveoffstack_newer_than () from /opt/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/x86_64-linux-thread-multi/auto/Math/Pari/Pari.so
(gdb) bt
#0  0x00007ffff367bea7 in moveoffstack_newer_than () from /opt/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/x86_64-linux-thread-multi/auto/Math/Pari/Pari.so
#1  0x00007ffff367c008 in XS_Math__Pari_DESTROY () from /opt/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/x86_64-linux-thread-multi/auto/Math/Pari/Pari.so
#2  0x00007ffff5bca17c in Perl_pp_entersub () from /opt/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/x86_64-linux-thread-multi/CORE/libperl.so
#3  0x00007ffff5b5c771 in Perl_call_sv () from /opt/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/x86_64-linux-thread-multi/CORE/libperl.so
#4  0x00007ffff5bd0629 in Perl_sv_clear () from /opt/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/x86_64-linux-thread-multi/CORE/libperl.so
#5  0x00007ffff5bd0ce2 in Perl_sv_free2 () from /opt/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/x86_64-linux-thread-multi/CORE/libperl.so
#6  0x00007ffff5bcb647 in S_visit () from /opt/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/x86_64-linux-thread-multi/CORE/libperl.so
#7  0x00007ffff5bd1456 in Perl_sv_clean_objs () from /opt/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/x86_64-linux-thread-multi/CORE/libperl.so
#8  0x00007ffff5b5e4a7 in perl_destruct () from /opt/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/x86_64-linux-thread-multi/CORE/libperl.so
#9  0x00007ffff7f8d477 in modperl_perl_destruct () from /opt/perl5/perlbrew/perls/perl-5.14.2/usr/lib/apache2/modules/mod_perl.so
#10 0x00007ffff7f7d81e in modperl_interp_destroy () from /opt/perl5/perlbrew/perls/perl-5.14.2/usr/lib/apache2/modules/mod_perl.so
#11 0x00007ffff7f7e3c5 in modperl_tipool_destroy () from /opt/perl5/perlbrew/perls/perl-5.14.2/usr/lib/apache2/modules/mod_perl.so
#12 0x00007ffff7f7d882 in modperl_interp_pool_destroy () from /opt/perl5/perlbrew/perls/perl-5.14.2/usr/lib/apache2/modules/mod_perl.so
#13 0x00007ffff776499e in apr_pool_destroy () from /usr/lib/libapr-1.so.0
#14 0x00007ffff7764b95 in apr_pool_clear () from /usr/lib/libapr-1.so.0
#15 0x0000555555585e67 in main ()

More info about the environment:

  • Debian 7.11
  • perl-5.14.2 (same as system perl but built with perlbrew)
  • mod_perl2 (built manually)

How can I get to the root cause of this?

Math::Pari is not thread safe, so probably you are running under threaded MPM, try installing prefork model for Apache2. If you're on Debian/Ubuntu try this:

sudo apt-get install apache2-mpm-prefork

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM