Hello,

This has been reported before on the list but I don't think that there
was a resolution to the problem.

I have the following script which is the smallest failing case I can get to:


#!/usr/bin/env perl

use strict;
use warnings;
use DBI;
use DBD::mysql;

my $mysql_auto_reconnect = 1;    # causes segfault
### my $mysql_auto_reconnect = 0;    # does not cause segfault

# print out the various versions of all modules:
print "$_: " . ( $_->VERSION || '-' ) . "\n"
    for map { s{/}{::}g; s{\.pm$}{}; $_ } sort keys %INC;

# connect to the database
my $dbh
    = DBI->connect( "dbi:mysql:test", 'root', '',
    { mysql_auto_reconnect => $mysql_auto_reconnect },
    );

# Check that we are connected to the database
warn $dbh->ping ? "connected to db" : "ERROR";

# restart the database server - will drop all connections
warn "--------- restarting db now -------------";
system('/etc/init.d/mysql restart'); # hacky but effective :)
sleep 2;
warn "--------- restarted db -------------";

# Try to use the old handle - should return an error but not kill the perl
# process
warn $dbh->ping ? "connected to db" : "ERROR";

1; #######################################################



When I run this I get the following output:



AutoLoader: 5.60
Carp: 1.04
Config: -
DBD::mysql: 4.008
DBI: 1.605
DBI::Const::GetInfo::ANSI: -
DBI::Const::GetInfo::ODBC: -
DBI::Const::GetInfoType: -
DynaLoader: 1.04
Exporter: 5.58
Exporter::Heavy: 5.58
List::Util: 1.19
Scalar::Util: 1.19
XSLoader: 0.06
strict: 1.03
vars: 1.01
warnings: 1.05
warnings::register: 1.01
connected to db at startup.pl line 22.
--------- restarting db now ------------- at startup.pl line 25.
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..
--------- restarted db ------------- at startup.pl line 28.
Segmentation fault (core dumped)



Getting a backtrace out of gdb gives me this:


hinudev:/etc/apache-perl# gdb /usr/bin/perl core.5501
GNU gdb 6.4.90-debian
<snip>........</snip>
Core was generated by `perl startup.pl'.
Program terminated with signal 11, Segmentation fault.
#0  0xb7968590 in mysql_ping () from /usr/lib/libmysqlclient.so.15
(gdb) backtrace
#0  0xb7968590 in mysql_ping () from /usr/lib/libmysqlclient.so.15
#1  0xb7b18904 in XS_DBD__mysql__db_ping () from
/usr/local/lib/perl/5.8.8/auto/DBD/mysql/mysql.so
#2  0xb7b48724 in XS_DBI_dispatch () from
/usr/local/lib/perl/5.8.8/auto/DBI/DBI.so
#3  0x080bdaa1 in Perl_pp_entersub ()
#4  0x080bc379 in Perl_runops_standard ()
#5  0x08063bfd in perl_run ()
#6  0x0805ffd1 in main ()


my 'perl -V' follows, it is the current debian-etch default (although
we compiled DBD::mysql from source):

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=linux, osvers=2.6.24.4, archname=i486-linux-gnu-thread-multi
    uname='linux ninsei 2.6.24.4 #1 smp preempt fri apr 18 15:36:09
pdt 2008 i686 gnulinux '
    config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN
-Dcccdlflags=-fPIC -Darchname=i486-linux-gnu -Dprefix=/usr
-Dprivlib=/usr/share/perl/5.8 -Darchlib=/usr/lib/perl/5.8
-Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5
-Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local
-Dsitelib=/usr/local/share/perl/5.8.8
-Dsitearch=/usr/local/lib/perl/5.8.8 -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.8 -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 -pipe -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN
-fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='4.1.2 20061115 (prerelease) (Debian
4.1.1-21)', 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.6.so, so=so, useshrplib=true, libperl=libperl.so.5.8.8
    gnulibc_version='2.3.6'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
                        PERL_MALLOC_WRAP THREADS_HAVE_PIDS USE_ITHREADS
                        USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
  Built under linux
  Compiled at Apr 25 2008 20:23:05
  @INC:
    /etc/perl
    /usr/local/lib/perl/5.8.8
    /usr/local/share/perl/5.8.8
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.8
    /usr/share/perl/5.8
    /usr/local/lib/site_perl
    /usr/local/lib/perl/5.8.4
    /usr/local/share/perl/5.8.4
    .


mysql is also the debian-etch default, version 5.0.32


I don't really know what else would be useful for you to debug this,
at least it is repeatable on my box. On another box (DBI 1.601,
DBD::mysql 4.005, otherwise identical) the issue does not occur.

Any help getting this fixed would be great. Workarounds welcome too :)

-- 
[EMAIL PROTECTED] - http://ecclestoad.co.uk

Reply via email to