BUG #7968: Perl DBI segfaults in connect()

Поиск
Список
Период
Сортировка
От mperilstein@trueposition.com
Тема BUG #7968: Perl DBI segfaults in connect()
Дата
Msg-id E1UHchV-0001rX-Tx@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #7968: Perl DBI segfaults in connect()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      7968
Logged by:          Mitchell Perilstein
Email address:      mperilstein@trueposition.com
PostgreSQL version: 9.1.5
Operating system:   SPARC Solaris 10
Description:        =


Summary: A perl DBI/DBD client makes a connect() call to a db server in down
or restarting state and coredumps.  There was a similar stack trace reported
in 2011 but not exactly.  I can probably reproduce this more succinctly with
a testcase if needed.

This code (part of Bucardo) was the call:

    $dbh =3D DBI->connect
        (
         $dsn,
         $user,
         $pass,
         {AutoCommit=3D>0, RaiseError=3D>1, PrintError=3D>0}
    );

The perl caller logs this and crashes:

    DBI
connect('dbname=3DTPLocationGateway;port=3D5432;host=3Dtplocalvirt','tpadmi=
n',...)
failed: =

    FATAL:  database "TPLocationGateway" does not exist at
/tpapp/tpdb/lib/perl5/Bucardo.pm line 4936

The Solaris coredump looks like this:

    #  pstack core
    core 'core' of 18694:   perl /tpapp/tpdb/bin/bucardo
--log-destination=3D/tpdata/tpdb/logs --log
     fed60fb0 pg_warn  (0, ae3648, 5fb0f0, 2d764, aa0f20, fed60f78) + 38
     fed27174 pqGetErrorNotice3 (adb080, 11000, 0, abf545, 0, ffbfed0c) +
4fc
     fed260a8 pqParseInput3 (adb080, adb3f4, 4, ffbfed78, fed431ac, 282019)
+ 168
     fed1db30 PQgetResult (adb080, adb080, 1, 2000000, 128808, fed431ac) +
c4
     fed726a8 handle_old_async (4bada0, a75548, 1000000, 8000000, 64,
fed8e6e0) + 5c4
     fed6d088 pg_st_destroy (4bada0, adcf20, 0, 217ec, fed8e6e0, a75548) +
198
     fed59af8 XS_DBD__Pg__st_DESTROY (128808, 4, 803948, fed8e6e0, 2245c,
4bada0) + 304
     feecec58 XS_DBI_dispatch (803948, c06a8, feeda8b0, feeec0a4, 0, 22460)
+ 20f0
     ff2a7634 Perl_pp_entersub (c0db4, 0, ffc00000, c2538, ffbff5a0,
ff348000) + 6fc
     ff269c2c S_call_body (ffbff5a0, 0, 3000, de41c, 529e50, ff35d978) + 54
     ff2698c0 Perl_call_sv (2c00, 2c00, 3050, 26e3c, ff35b3e4, ff35b3c8) +
9cc
     ff2f0f8c Perl_sv_clear (8147b0, 3000, 3000, 124be0, ff348000, 41) +
280
     ff2f18d0 Perl_sv_free (8147b0, ff2f0c98, 568f8, 8, 0, 8147b0) + 1d8
     ff2f14a8 Perl_sv_clear (501f2c, 7d4, ff2f15a8, 0, ff348000, 3000) +
79c
     ff2f18d0 Perl_sv_free (501f2c, 7d4, 568f8, ff, 0, 501f2c) + 1d8
     ff245628 Perl_mg_free (a5c894, ff35b398, 0, b, 2000900b, 5ffdb8) + ac
     ff2f121c Perl_sv_clear (a5c894, 1, 2c00, ff35d97c, ff348000, 0) + 510
     ff2f18d0 Perl_sv_free (a5c894, 5fb428, 568f8, ff2e69e4, 0, a5c894) +
1d8
     ff2e692c S_visit  (ff2e6968, 5fb428, 5fb668, 5fb278, ff348000, 1d7) +
80
     ff2e6b28 Perl_sv_clean_objs (2f80, 1, ff34b560, ff348000, 61514, 2c00)
+ 48
     ff264c84 perl_destruct (0, 3400, 0, 1, ff35b3ec, 3400) + 2f8
     00011050 main     (8, ffbffaf4, 0, 22400, 22420, 22400) + b4
     00010f84 _start   (0, 0, 0, 0, 0, 0) + 108
    # pflags core
    core 'core' of 18694:   perl /tpapp/tpdb/bin/bucardo
--log-destination=3D/tpdata/tpdb/logs --log
            data model =3D _ILP32  flags =3D MSACCT|MSFORK
     /1:    flags =3D 0
            sigmask =3D 0xffffbefc,0x0000ffff  cursig =3D SIGSEGV

Solaris (but we've seen it on similar boxes):

    #  uname -a
    SunOS WilWlg1 5.10 Generic_147440-25 sun4v sparc sun4v

Perl v5.8.4 :

    # perl -V
    Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
      Platform:
        osname=3Dsolaris, osvers=3D2.10, archname=3Dsun4-solaris-64int
        uname=3D'sunos localhost 5.10 sun4u sparc SUNW,Ultra-2'
        config_args=3D''
        hint=3Drecommended, useposix=3Dtrue, d_sigaction=3Ddefine
        usethreads=3Dundef use5005threads=3Dundef useithreads=3Dundef
usemultiplicity=3Dundef
        useperlio=3Ddefine d_sfio=3Dundef uselargefiles=3Ddefine usesocks=
=3Dundef
        use64bitint=3Ddefine use64bitall=3Dundef uselongdouble=3Dundef
        usemymalloc=3Dn, bincompat5005=3Dundef
      Compiler:
        cc=3D'cc', ccflags =3D'-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=3D64
-xarch=3Dv8 -D_TS_ERRNO',
        optimize=3D'-xO3 -xspace -xildoff',
        cppflags=3D''
        ccversion=3D'Sun WorkShop', gccversion=3D'', gccosandvers=3D''
        intsize=3D4, longsize=3D4, ptrsize=3D4, doublesize=3D8, byteorder=
=3D87654321
        d_longlong=3Ddefine, longlongsize=3D8, d_longdbl=3Ddefine, longdbls=
ize=3D16
        ivtype=3D'long long', ivsize=3D8, nvtype=3D'double', nvsize=3D8,
Off_t=3D'off_t', lseeksize=3D8
        alignbytes=3D8, prototype=3Ddefine
      Linker and Libraries:
        ld=3D'cc', ldflags =3D''
        libpth=3D/lib /usr/lib /usr/ccs/lib
        libs=3D-lsocket -lnsl -ldl -lm -lc
        perllibs=3D-lsocket -lnsl -ldl -lm -lc
        libc=3D/lib/libc.so, so=3Dso, useshrplib=3Dtrue, libperl=3Dlibperl.=
so
        gnulibc_version=3D''
      Dynamic Linking:
        dlsrc=3Ddl_dlopen.xs, dlext=3Dso, d_dlsymun=3Dundef, ccdlflags=3D'-R
/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE'
        cccdlflags=3D'-KPIC', lddlflags=3D'-G'
    =

    =

    Characteristics of this binary (from libperl): =

      Compile-time options: USE_64_BIT_INT USE_LARGE_FILES
      Locally applied patches:
            22667 The optree builder was looping when constructing the ops
...
            22715 Upgrade to FileCache 1.04
            22733 Missing copyright in the README.
            22746 fix a coredump caused by rv2gv not fully converting a PV
...
            22755 Fix 29149 - another UTF8 cache bug hit by substr.
            22774 [perl #28938] split could leave an array without ...
            22775 [perl #29127] scalar delete of empty slice returned
garbage
            22776 [perl #28986] perl -e "open m" crashes Perl
            22777 add test for change #22776 ("open m" crashes Perl)
            22778 add test for change #22746 ([perl #29102] Crash on assign
...
            22781 [perl #29340] Bizarre copy of ARRAY make sure a pad op's
...
            22796 [perl #29346] Double warning for int(undef) and abs(undef)
...
            22818 BOM-marked and (BOMless) UTF-16 scripts not working
            22823 [perl #29581] glob() misses a lot of matches
            22827 Smoke [5.9.2] 22818 FAIL(F) MSWin32 WinXP/.Net SP1 (x86/1
cpu)
            22830 [perl #29637] Thread creation time is hypersensitive
            22831 improve hashing algorithm for ptr tables in perl_clone:
...
            22839 [perl #29790] Optimization busted: '@a =3D "b", sort @a'
...
            22850 [PATCH] 'perl -v' fails if local_patches contains code
snippets
            22852 TEST needs to ignore SCM files
            22886 Pod::Find should ignore SCM files and dirs
            22888 Remove redundant %SIG assignments from FileCache
            23006 [perl #30509] use encoding and "eq" cause memory leak
            23074 Segfault using HTML::Entities
            23106 Numeric comparison operators mustn't compare addresses of
...
            23320 [perl #30066] Memory leak in nested shared data structures
...
            23321 [perl #31459] Bug in read()
            27722 perlio.c breaks on Solaris/gcc when > 256 FDs are
available
            SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962
            6663288 Upgrade to CGI.pm 3.33
            REGEXP0 - fix for UTF-8 recoding in regexps - CVE-2007-5116
            6758953 Perl Sys::Syslog can log messages with wrong severity
            6935710 patch 141552-01 causes an error when the Syslog perl
module is used
            6961567 CVE-2010-1168 - Safe.pm 2.24 and earlier may allow
attackers to break out of safe compartment
            7004391 CGI.pm needs update to filter newlines in headers
(CVE-2010-2761, CVE-2010-4411)
            7116936 Problem with utility/perl
      Built under solaris
      Compiled at Jan  8 2012 04:18:12
      %ENV:
        PERL5LIB=3D"/tpapp/tpdb/lib/perl5"
      @INC:
        /tpapp/tpdb/lib/perl5/sun4-solaris-64int
        /tpapp/tpdb/lib/perl5
        /usr/perl5/5.8.4/lib/sun4-solaris-64int
        /usr/perl5/5.8.4/lib
        /usr/perl5/site_perl/5.8.4/sun4-solaris-64int
        /usr/perl5/site_perl/5.8.4
        /usr/perl5/site_perl
        /usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int
        /usr/perl5/vendor_perl/5.8.4
        /usr/perl5/vendor_perl
        .

Interesting Modules:
     DBD-Pg-2.19.3
     DBI-1.623
     DBIx-Safe-1.2.5

Bucardo:
    git version e83e2e22e79c6cf6be5912925d50e271e02a886d
    approximately version 4.99.6 plus a little

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Damian Weber
Дата:
Сообщение: Re: BUG #7955: argv=0x0 on program start
Следующее
От: navin.pro@gmail.com
Дата:
Сообщение: BUG #7956: Installation fails saying database cluster initialization failed