DBD-mysql icon indicating copy to clipboard operation
DBD-mysql copied to clipboard

Segfault with DBD-mysql + worker MPM (multi-threaded) + mod_perl [rt.cpan.org #123240]

Open mbeijen opened this issue 8 years ago • 0 comments
trafficstars

Migrated from rt.cpan.org#123240 (status was 'new')

Requestors:

From [email protected] on 2017-10-10 18:33:58:

Heya,

started getting the following segfault after upgrading from CentOS 6.9
to 7.4. The perl code is completely unchanged. This problem does not
occur on every call to mysql routines, and is only happening when
using the worker MPM (threadeded), the prefork (process-based) MPM
works fine, indicating some threading / race condition problem. This
worked fine with worker MPM prior to the upgrade, but  too many things
have changed with the OS upgrade to be able to marrow down the issue
any further.

DBD-mysql-4.043
DBI-1.637
Apache-DBI-1.12

Problem occurs with both distro packages (slightly older versions) and
packages compiled from sources (CPAN), mod_perl info follows below.

A workaround is to switch from the worker MPM to the prefork one, at
the cost of higher memory usage.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f0ccbfef700 (LWP 11328)]
_dbi_state_lval (my_perl=0x0) at DBI.xs:324
324         dMY_CXT;
(gdb) bt
#0  _dbi_state_lval (my_perl=0x0) at DBI.xs:324
#1  0x00007f0cdd848393 in dbi_get_state (my_perl=0x0) at dbdimp.c:49
#2  0x00007f0cdd8519b6 in mysql_st_fetch (sth=0x7f0cbc69a1b8,
imp_sth=0x7f0cbc5aba10) at dbdimp.c:3915
#3  0x00007f0cdd85a4d1 in XS_DBD__mysql__st_fetchrow_array
(my_perl=0x7f0cf37b48c0, cv=0x7f0cf59e91b0) at ./mysql.xsi:639
#4  0x00007f0cdfcfd035 in XS_DBI_dispatch (my_perl=0x7f0cf37b48c0,
cv=0x7f0cf580a928) at DBI.xs:3797
#5  0x00007f0ce43c740f in Perl_pp_entersub (my_perl=0x7f0cf37b48c0) at
pp_hot.c:2778
#6  0x00007f0ce43bfb86 in Perl_runops_standard
(my_perl=0x7f0cf37b48c0) at run.c:41
#7  0x00007f0ce4357168 in Perl_call_sv
(my_perl=my_perl@entry=0x7f0cf37b48c0, sv=0x7f0cf4fd7028,
flags=<optimized out>,
    flags@entry=10) at perl.c:2705
#8  0x00007f0ce46b0bf9 in modperl_callback
(my_perl=my_perl@entry=0x7f0cf37b48c0, handler=0x7f0cf0c74ec8,
p=p@entry=0x7f0cbc0028f8,
    r=r@entry=0x7f0cbc002970, s=s@entry=0x7f0cea8e9ae8,
args=0x7f0cac018ef0) at modperl_callback.c:100
#9  0x00007f0ce46b1408 in modperl_callback_run_handlers
(idx=idx@entry=6, type=type@entry=3, r=r@entry=0x7f0cbc002970,
c=c@entry=0x0,
    s=0x7f0cea8e9ae8, pconf=pconf@entry=0x0, plog=plog@entry=0x0,
ptemp=ptemp@entry=0x0, run_mode=run_mode@entry=MP_HOOK_RUN_FIRST)
    at modperl_callback.c:236
#10 0x00007f0ce46b190f in modperl_callback_per_dir (idx=idx@entry=6,
r=r@entry=0x7f0cbc002970,
    run_mode=run_mode@entry=MP_HOOK_RUN_FIRST) at modperl_callback.c:342
#11 0x00007f0ce46ac2fb in modperl_response_handler_run
(r=0x7f0cbc002970) at mod_perl.c:1024
#12 0x00007f0ce46ac536 in modperl_response_handler_cgi
(r=0x7f0cbc002970) at mod_perl.c:1095
#13 0x00007f0cea45da10 in ap_run_handler ()
#14 0x00007f0cea45df59 in ap_invoke_handler ()
#15 0x00007f0cea472ada in ap_process_async_request ()
#16 0x00007f0cea472db4 in ap_process_request ()
#17 0x00007f0cea46efb2 in ap_process_http_connection ()
#18 0x00007f0cea467010 in ap_run_process_connection ()
#19 0x00007f0ce5e9e78b in worker_thread () from
/etc/httpd/modules/mod_mpm_worker.so
#20 0x00007f0ce8ee2e25 in start_thread (arg=0x7f0ccbfef700) at
pthread_create.c:308
#21 0x00007f0ce8a0c34d in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:113

-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:

 (see above)

2. Used Components and their Configuration:

*** mod_perl version 2.000010

*** using /usr/lib64/perl5/vendor_perl/Apache2/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_CONFIG  => /usr/bin/apr-1-config
  MP_APR_LIB     => aprext
  MP_APXS        => /usr/bin/apxs
  MP_COMPAT_1X   => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME     => mod_perl
  MP_USE_DSO     => 1


*** The httpd binary was not found


*** (apr|apu)-config linking info

 -L/usr/lib64 -laprutil-1 -lldap_r  -llber -ldb-5.3   -lexpat -ldb-5.3
 -lapr-1  -lpthread -ldl



*** /usr/bin/perl -V
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:

  Platform:
    osname=linux, osvers=3.10.0-514.16.1.el7.x86_64,
archname=x86_64-linux-thread-multi
    uname='linux c1bm.rdu2.centos.org 3.10.0-514.16.1.el7.x86_64 #1
smp wed apr 12 15:04:24 utc 2017 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -Doptimize=-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic
-Dccdlflags=-Wl,--enable-new-dtags -Dlddlflags=-shared -O2 -g -pipe
-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic
-Wl,-z,relro  -DDEBUGGING=-g -Dversion=5.16.3 -Dmyhostname=localhost
-Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc.
-Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local
-Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib64/perl5
-Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl
-Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5/vendor_perl
-Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64
/usr/lib64 -Duseshrplib -Dusethreads -Duseithreads
-Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db
-Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio
-Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly
-Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto
-Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto
-Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto
-Dscriptdir=/usr/bin -Dusesitecustomize'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4
-grecord-gcc-switches -m64 -mtune=generic',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.8.5 20150623 (Red Hat 4.8.5-16)',
gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -fstack-protector'
    libpth=/usr/local/lib64 /lib64 /usr/lib64
    libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread
-lc -lgdbm_compat
    perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.17'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,
ccdlflags='-Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
-Wl,-z,relro '


Characteristics of this binary (from libperl):
  Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
                        PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL
                        USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
                        USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
                        USE_REENTRANT_API USE_SITECUSTOMIZE
  Locally applied patches:
        Fedora Patch1: Removes date check, Fedora/RHEL specific
        Fedora Patch3: support for libdir64
        Fedora Patch4: use libresolv instead of libbind
        Fedora Patch5: USE_MM_LD_RUN_PATH
        Fedora Patch6: Skip hostname tests, due to builders not being
network capable
        Fedora Patch7: Dont run one io test due to random builder failures
        Fedora Patch9: Fix find2perl to translate ? glob properly (RT#113054)
        Fedora Patch10: Fix broken atof (RT#109318)
        Fedora Patch13: Clear $@ before "do" I/O error (RT#113730)
        Fedora Patch14: Do not truncate syscall() return value to 32
bits (RT#113980)
        Fedora Patch15: Override the Pod::Simple::parse_file (CPANRT#77530)
        Fedora Patch16: Do not leak with attribute on my variable (RT#114764)
        Fedora Patch17: Allow operator after numeric keyword argument
(RT#105924)
        Fedora Patch18: Extend stack in File::Glob::glob, (RT#114984)
        Fedora Patch19: Do not crash when vivifying $|
        Fedora Patch20: Fix misparsing of maketext strings (CVE-2012-6329)
        Fedora Patch21: Add NAME headings to CPAN modules (CPANRT#73396)
        Fedora Patch22: Fix leaking tied hashes (RT#107000) [1]
        Fedora Patch23: Fix leaking tied hashes (RT#107000) [2]
        Fedora Patch24: Fix leaking tied hashes (RT#107000) [3]
        Fedora Patch25: Fix dead lock in PerlIO after fork from thread
(RT#106212)
        Fedora Patch26: Make regexp safe in a signal handler (RT#114878)
        Fedora Patch27: Update h2ph(1) documentation (RT#117647)
        Fedora Patch28: Update pod2html(1) documentation (RT#117623)
        Fedora Patch29: Document Math::BigInt::CalcEmu requires
Math::BigInt (CPAN RT#85015)
        RHEL Patch30: Use stronger algorithm needed for FIPS in
t/op/crypt.t (RT#121591)
        RHEL Patch31: Make *DBM_File desctructors thread-safe (RT#61912)
        RHEL Patch32: Use stronger algorithm needed for FIPS in
t/op/taint.t (RT#123338)
        RHEL Patch33: Remove CPU-speed-sensitive test in Benchmark test
        RHEL Patch34: Make File::Glob work with threads again
        RHEL Patch35: Fix CRLF conversion in ASCII FTP upload (CPAN RT#41642)
        RHEL Patch36: Do not leak the temp utf8 copy of namepv (CPAN RT#123786)
        RHEL Patch37: Fix duplicating PerlIO::encoding when spawning
threads (RT#31923)
  Built under linux
  Compiled at Aug  2 2017 17:45:03
  %ENV:
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    /usr/local/lib64/perl5
    /usr/local/share/perl5
    /usr/lib64/perl5/vendor_perl
    /usr/share/perl5/vendor_perl
    /usr/lib64/perl5
    /usr/share/perl5
    .

*** Packages of interest status:

Apache2            : -
Apache2::Request   : 2.13
CGI                : 3.63
ExtUtils::MakeMaker: 6.68
LWP                : 6.05
mod_perl           : -
mod_perl2          : 2.000010


This report was generated by /usr/bin/mp2bug on Tue Oct 10 18:11:24 2017 GMT.

-------------8<---------- End Bug Report --------------8<----------

Thank you, please let me know if you need more information.

Tomas

mbeijen avatar Nov 14 '17 19:11 mbeijen