Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Oct 2008 20:17:34 -0600
From:      John Rushford <jjr@alisa.org>
To:        <perl@freebsd.org>
Subject:   DBD::Pg is broken - coredumps
Message-ID:  <C5180BDE.1016%jjr@alisa.org>

next in thread | raw e-mail | index | archive | help
Greetings,

I'm having trouble with DBD::Pg on a FreeBSD 7.1-PRERELEASE machine.  When
connecting to a postgresql database, the perl script coredumps.  See
attached back trace, version info, and test perl script.  Is there some
issue with pthreads?  Any ideas?

John Rushford
jjr@alisa.org

Details:

FreeBSD 7.1-PRERELEASE built after cvsup Sun Oct 12, 2008 kernel GENERIC
amd64

p5-DBD-Pg-2.10.7    Provides access to PostgreSQL databases through the DBI
p5-DBD-SQLite-1.14  Provides access to SQLite3 databases through the DBI
p5-DBD-mysql-4.006  MySQL driver for the Perl5 Database Interface (DBI)
p5-DBI-1.60.4       The perl5 Database Interface.  Required for DBD::*
modules
postgresql-client-8.2.9 PostgreSQL database (client)
postgresql-server-8.2.9 The most advanced open-source database available
anywhere

Gdb backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x523000 (LWP 100225)]
0x0000000801c65afb in pthread_cond_init () from /lib/libthr.so.3
(gdb) bt
#0  0x0000000801c65afb in pthread_cond_init () from /lib/libthr.so.3
#1  0x0000000801434aa0 in pq_block_sigpipe () from /usr/local/lib/libpq.so.5
#2  0x0000000801434c28 in pqsecure_write () from /usr/local/lib/libpq.so.5
#3  0x000000080142da5e in pqReadData () from /usr/local/lib/libpq.so.5
#4  0x0000000801427691 in pqPacketSend () from /usr/local/lib/libpq.so.5
#5  0x0000000801428c32 in PQconnectPoll () from /usr/local/lib/libpq.so.5
#6  0x0000000801428dae in PQresetPoll () from /usr/local/lib/libpq.so.5
#7  0x000000080142a3cf in PQconnectdb () from /usr/local/lib/libpq.so.5
#8  0x0000000801311bc6 in pg_db_login ()
   from /usr/local/lib/perl5/site_perl/5.8.8/mach/auto/DBD/Pg/Pg.so
#9  0x0000000801302b9a in XS_DBD__Pg__db__login ()
   from /usr/local/lib/perl5/site_perl/5.8.8/mach/auto/DBD/Pg/Pg.so
#10 0x00000008006bf17c in Perl_pp_entersub ()
   from /usr/local/lib/perl5/5.8.8/mach/CORE/libperl.so
#11 0x00000008006b7e1e in Perl_runops_standard ()
   from /usr/local/lib/perl5/5.8.8/mach/CORE/libperl.so
#12 0x0000000800668aa5 in Perl_call_sv ()
   from /usr/local/lib/perl5/5.8.8/mach/CORE/libperl.so
#13 0x0000000800db8446 in XS_DBI_dispatch ()
   from /usr/local/lib/perl5/site_perl/5.8.8/mach/auto/DBI/DBI.so
#14 0x00000008006bf17c in Perl_pp_entersub ()
   from /usr/local/lib/perl5/5.8.8/mach/CORE/libperl.so
#15 0x00000008006b7e1e in Perl_runops_standard ()
   from /usr/local/lib/perl5/5.8.8/mach/CORE/libperl.so
#16 0x0000000800669632 in perl_run ()
   from /usr/local/lib/perl5/5.8.8/mach/CORE/libperl.so
#17 0x00000000004015cf in main ()
(gdb) 


This perl script works fine with mysql but coredumps at DBI->connect with
postgresql.  

#!/usr/bin/perl

use strict;
use CGI qw(:standard);
use DBI;

my $seq = 0;
my @array;
my $dbname = $ENV{'DBNAME'};
my $dbuser = $ENV{'DBUSER'};
my $dbpasswd = $ENV{'DBPASSWD'};
my $dsn = "dbi:Pg:dbname=$dbname;host=127.0.0.1;port=5432";
#my $dsn = "dbi:mysql:database=$dbname;host=127.0.0.1;port=3306";
my $dbh;

if (length ($dbname) == 0) {
        print "DBNAME is not set\n";
        exit 0;
}
if (length ($dbuser) == 0) {
        print "DBUSER is not set\n";
        exit 0;
}
if (length ($dbpasswd) == 0) {
        print "DBPASSWD is not set\n";
        exit 0;
}
$dbh = DBI->connect($dsn,"$dbuser","$dbpasswd", {'AutoCommit' =>
1,RaiseError => 1, P
rintError => 0}) or
        die ("can't connect to $dbname");

my $sth = $dbh->prepare ("SELECT * from x");

$sth->execute;
while ( @array = $sth->fetchrow()) {
        print "val = $array[0]\n";
}
$sth->finish;






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C5180BDE.1016%jjr>