I was getting segfaults with mod_perl2 (1.99_10 on 2.0.48) on my development box today. After a lot of searching, it turns out it was because of a problem with Time::Piece.
I could recreate it by placing 'use Time::Piece::MySQL' in the startup.pl file. This would cause the server to segfault on startup. Time::Piece::MySQL has a BEGIN statement that calls 'strptime' in Time::Piece, and that was triggering the Segfault. I thought it had to be mod_perl2, because Time::Piece worked fine on it's own and appeared to work under mod_perl1 as well, just not under mod_perl2. However, it turns out that by re-compiling Time::Piece the problem went away. I was using a debian package libtime-piece-perl 1.08-2 and debian perl 5.8.1-4 (threaded). By reinstalling and recompiling Time::Piece using CPAN (still version 1.08), the problem went away. So I guess the problem is in debians libtime-piece-perl package. But why was mod_perl2 segfaulting, and regular CGI usage worked fine? The backtrace shows it occurs when mod_perl is in the destruct phase. I thought it worthwhile to post this, since there might be an issue in the mod_perl2 code in the cleanup routines that are triggering the problem... Here is the backtrace: Starting program: /root/httpd/prefork/bin/httpd -k start [New Thread 16384 (LWP 25873)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 16384 (LWP 25873)] 0x4034ea57 in Perl_pregfree () from /usr/lib/libperl.so.5.8 (gdb) bt #0 0x4034ea57 in Perl_pregfree () from /usr/lib/libperl.so.5.8 #1 0x40302b97 in perl_destruct () from /usr/lib/libperl.so.5.8 #2 0x402cbbb5 in modperl_perl_destruct (perl=0x816aca0) at modperl_perl.c:130 #3 0x402b9696 in modperl_interp_destroy (interp=0x817ff38) at modperl_interp.c:128 #4 0x402b9881 in modperl_interp_pool_destroy (data=0x81335a8) at modperl_interp.c:184 #5 0x400ad10d in run_cleanups (cref=0x8168cc0) at apr_pools.c:1994 #6 0x400ac84d in apr_pool_destroy (pool=0x8168cb0) at apr_pools.c:763 #7 0x400ac808 in apr_pool_clear (pool=0x80d7c18) at apr_pools.c:723 #8 0x08098a82 in main (argc=3, argv=0xbffffe14) at main.c:617 (gdb) # perl -V Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration: Platform: osname=linux, osvers=2.4.22-xfs+ti1211, archname=i386-linux-thread-multi uname='linux kosh 2.4.22-xfs+ti1211 #1 sun oct 12 12:47:45 est 2003 i686 gnulinux ' config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.8.1 -Darchlib=/usr/lib/perl/5.8.1 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.8.1 -Dsitearch=/usr/local/lib/perl/5.8.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Uusenm -Duseshrplib -Dlibperl=libperl.so.5.8.1 -Dd_dosuid -des' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O3', cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='3.3.2 (Debian)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt perllibs=-ldl -lm -lpthread -lc -lcrypt libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.so.5.8.1 gnulibc_version='2.3.2' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Built under linux Compiled at Oct 24 2003 21:37:39 @INC: /etc/perl /usr/local/lib/perl/5.8.1 /usr/local/share/perl/5.8.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8.1 /usr/share/perl/5.8.1 /usr/local/lib/site_perl /usr/local/lib/perl/5.8.0 /usr/local/share/perl/5.8.0 Cheers, Cees