perl DBI coredump with postgresql database
Greetings,
I've written some perl programs that coredump when connecting to a
postgresql database, DBI->connect;. Has anyone else run into and solved
this problem?
regards
John
FreeBSD 7.1-PRERELEASE amd64
p5-DBI-1.60.4 The perl5 Database Interface. Required for DBD::*
modules
p5-DBD-Pg-2.10.7 Provides access to PostgreSQL databases through the DBI
postgresql-client-8.2.9 PostgreSQL database (client)
postgresql-server-8.2.9 The most advanced open-source database available
anywhere
backtrace from the coredump:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x523000 (LWP 100118)]
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 ()
---Type <return> to continue, or q <return> to quit---
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)
Re: perl DBI coredump with postgresql database
John Rushford wrote:[color=blue]
> Greetings,
>
> I've written some perl programs that coredump when connecting to a
> postgresql database, DBI->connect;. Has anyone else run into and solved
> this problem?
>
> regards
> John
>
> FreeBSD 7.1-PRERELEASE amd64
> p5-DBI-1.60.4 The perl5 Database Interface. Required for DBD::*
> modules
> p5-DBD-Pg-2.10.7 Provides access to PostgreSQL databases through the DBI
> postgresql-client-8.2.9 PostgreSQL database (client)
> postgresql-server-8.2.9 The most advanced open-source database available
> anywhere
>
> backtrace from the coredump:
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x523000 (LWP 100118)]
> 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 ()
> ---Type <return> to continue, or q <return> to quit---
> 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)[/color]
Thought I'd include the perl script that coredumps, its very simple:
#!/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:database=$dbname;host=127.0.0.1;port=5432";
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", {'RaiseError' => 1}) or
die ("can't connect to $dbname");
my $sth = $dbh->prepare ("SELECT nextval('transactions')");
$sth->execute;
while ( @array = $sth->fetchrow()) {
print "val = $array[0]\n";
}
$sth->finish;
Re: perl DBI coredump with postgresql database
John Rushford wrote:[color=blue]
> Greetings,
>
> I've written some perl programs that coredump when connecting to a
> postgresql database, DBI->connect;. Has anyone else run into and solved
> this problem?
>
> regards
> John
>
> FreeBSD 7.1-PRERELEASE amd64
> p5-DBI-1.60.4 The perl5 Database Interface. Required for DBD::*
> modules
> p5-DBD-Pg-2.10.7 Provides access to PostgreSQL databases through the DBI
> postgresql-client-8.2.9 PostgreSQL database (client)
> postgresql-server-8.2.9 The most advanced open-source database available
> anywhere
>
> backtrace from the coredump:
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x523000 (LWP 100118)]
> 0x0000000801c65afb in pthread_cond_init () from /lib/libthr.so.3
> (gdb) bt
> #0 0x0000000801c65afb in pthread_cond_init () from /lib/libthr.so.3[/color]
You could try this:
a) recompile perl port with WITH_THREADS=yes and recompile postgresql
port with thread safety enabled in the config (THREADSAFE option for
postgresql-client82).
b) recompile perl port without WITH_THREADS=yes and recompile postgresql
port without thread safety enabled.
If you are using apache there is also WITH_THREADS...