Segfault in threaded program after upgrade to DBI 1.620

Matthew Musgrove <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <CAJaTdr2+rqO5Q-bDdzQygkakbYBU_Y-f4HZn5TH-R_3EmUz+_A@mail.gmail.com>
We have this threaded program that runs as a daemonized service and it's
been happy for quite a while using DBI 1.616 and DBD::Oracle 1.30. Last
week, I updated DBI to 1.620 and DBD::Oracle 1.44 and when I restarted the
service, it segfaulted as soon as it created a new thread. I was pretty
sure that it wasn't in DBD::Oracle because I had tested a prerelease of the
new code and didn't have any problems with it. I reverted it back to DBI
1.616 and DBD::Oracle 1.30 and when I restarted the service, it was happy
again. Next I updated DBI to 1.620 and left DBD::Oracle alone. Again, it
segfaulted as soon as it created a new thread. It isn't my code so there
could be a bug or three lurking in there waiting to attack but as I said,
it's been working just fine. The only change was to DBI. I reverted DBI
back to 1.616 and decided to wait (you know, to see if anyone would report
anything).

Today, I had a little free time and decided to try it again. It took some
coaxing but I finally got it create a core dump (after setting
DAEMON_COREFILE_LIMIT="
unlimited"). I loaded the core dump in gdb and did a backtrace. It looks
like it segfaults in dbi_ima_dup. Unfortunately, this perl didn't have
debugging enabled. I compiled a new copy of perl (same version and I think
the same flags except with debugging), installed the same modules for it
and created another core dump. I logged 'backtrace', 'info registers' and
'thread apply all backtrace' to separate files. This was my first time
using gdb so that was interesting. I don't really know what sort of
information you need so... yeah.

I'm attaching output from perl -V (from both copies of perl) and 'info
registers'. I'll send a reply with the backtrace log next.

What other information do I need to provide? Does anyone have any tips or
pointers on how I can debug this further?

Matt
perl.log (application/octet-stream, 2.6 KB)
Summary of my perl5 (revision 5 version 12 subversion 3) configuration:
   
  Platform:
    osname=linux, osvers=2.6.18-164.9.1.el5, archname=x86_64-linux-thread-multi
    uname='linux nmsdev3.efjdfw.local 2.6.18-164.9.1.el5 #1 smp tue dec 15 20:57:57 est 2009 x86_64 x86_64 x86_64 gnulinux '
    config_args='-Dusethreads -Duselargefiles -Dprefix=/opt/perl -Accflags=-fPIC -de'
    hint=previous, 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='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC'
    ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-46)', 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='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.5.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'


Characteristics of this binary (from libperl): 
  Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL
                        USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
                        USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API
  Built under linux
  Compiled at Jan 24 2011 19:21:05
  %ENV:
    PERLLIB="/opt/nms/lib/perl"
  @INC:
    /opt/nms/lib/perl
    /opt/perl/lib/site_perl/5.12.3/x86_64-linux-thread-multi
    /opt/perl/lib/site_perl/5.12.3
    /opt/perl/lib/5.12.3/x86_64-linux-thread-multi
    /opt/perl/lib/5.12.3
    /opt/perl/lib/site_perl
    .
perld.log (application/octet-stream, 2.6 KB)
Summary of my perl5 (revision 5 version 12 subversion 3) configuration:
   
  Platform:
    osname=linux, osvers=2.6.18-238.9.1.el5, archname=x86_64-linux-thread-multi
    uname='linux nmsdev2.efjdfw.local 2.6.18-238.9.1.el5 #1 smp tue apr 12 18:10:13 edt 2011 x86_64 x86_64 x86_64 gnulinux '
    config_args='-de -Dprefix=/opt/perld/perls/perl-5.12.3 -Dusethreads -Duselargefiles -Doptimize=-O2 -Doptimize=-g'
    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='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-g',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-46)', 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='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.5.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -g -L/usr/local/lib -fstack-protector'


Characteristics of this binary (from libperl): 
  Compile-time options: DEBUGGING MULTIPLICITY PERL_DONT_CREATE_GVSV
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                        PERL_TRACK_MEMPOOL USE_64_BIT_ALL USE_64_BIT_INT
                        USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF
                        USE_REENTRANT_API
  Built under linux
  Compiled at May 10 2012 19:03:35
  %ENV:
    PERLLIB="/opt/nms/lib/perl"
  @INC:
    /opt/nms/lib/perl
    /opt/perld/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux-thread-multi
    /opt/perld/perls/perl-5.12.3/lib/site_perl/5.12.3
    /opt/perld/perls/perl-5.12.3/lib/5.12.3/x86_64-linux-thread-multi
    /opt/perld/perls/perl-5.12.3/lib/5.12.3
    .
registers.log (application/octet-stream, 968 B)
rax            0x0	0
rbx            0x8d63648	148256328
rcx            0x8c3bd48	147045704
rdx            0x7a96e88	128544392
rsi            0x427dba10	1115535888
rdi            0x0	0
rbp            0x427b88b0	0x427b88b0
rsp            0x427b8860	0x427b8860
r8             0x3	3
r9             0x3	3
r10            0x8	8
r11            0x3c2ec7b5f8	258482877944
r12            0x86e18cc	141433036
r13            0x3	3
r14            0x427dc000	1115537408
r15            0x1000	4096
rip            0x2ab069f07cdf	0x2ab069f07cdf <dbi_ima_dup+172>
eflags         0x10202	[ IF RF ]
cs             0x33	51
ss             0x2b	43
ds             0x0	0
es             0x0	0
fs             0x63	99
gs             0x0	0
fctrl          0x37f	895
fstat          0x0	0
ftag           0xffff	65535
fiseg          0x0	0
fioff          0x67f01f	6811679
foseg          0x0	0
fooff          0x427da970	1115531632
fop            0x59d	1437
mxcsr          0x1fa0	[ PE IM DM ZM OM UM PM ]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.