Re: DBD-Pg Segmentation Fault

2001-10-09 Thread Matt Nelson


 Does this always fail at the same iteration?
 

If there are no changes to the perl script, yes. If I add code to the
script, for example, a line to print the DBD-Pg version, the script
fails a few iterations sooner (16 in this case).

 Can you alter the failure point by adjusting ulimit up or down?
 

It does not appear to be directly related to a memory limit. I made
another version of the script that does not use DBI, and simply loads
data into a hash.  I let it run until it consumed over 40M before stopping
it. If I lower the limit sufficiently, I start getting Out of memory!
messages that stop the script without crashing.

 What is the backtrace from the core file?  It would be interesting to
 know if the crash is in libpq code, DBD-Pg code, or perl code.
 Knowing this doesn't fully isolate the problem, but it may provide a
 clue.

I have three different core dumps corresponding to three different
iteration counts. They all have different backtraces. I have included
all three below.

 - Matt

Core 1:
  (gdb) where
  #0  0x481b4232 in memmove ()
  #1  0x2c in ?? ()
  #2  0x480dada6 in Perl_pp_anonhash ()
  #3  0x480c26f1 in Perl_runops_standard ()
  #4  0x48080fec in S_call_body ()
  #5  0x48080b17 in perl_call_sv ()
  #6  0x481d1cd9 in XS_DBI_dispatch ()
  #7  0x480c8178 in Perl_pp_entersub ()
  #8  0x480c26f1 in Perl_runops_standard ()
  #9  0x48080fec in S_call_body ()
  #10 0x48080b17 in perl_call_sv ()
  #11 0x481d1cd9 in XS_DBI_dispatch ()
  #12 0x480c8178 in Perl_pp_entersub ()
  #13 0x480c26f1 in Perl_runops_standard ()
  #14 0x48080662 in S_run_body ()
  #15 0x48080378 in perl_run ()
  #16 0x804962f in main ()
  #17 0x8049379 in ___start ()
  (gdb)

Core 2:
  (gdb) where
  #0  0x481b3eb7 in memset ()
  #1  0x937f000 in ?? ()
  #2  0x481cf0ca in dbih_setup_handle ()
  #3  0x481d2c5c in XS_DBI__setup_handle ()
  #4  0x480c8178 in Perl_pp_entersub ()
  #5  0x480c26f1 in Perl_runops_standard ()
  #6  0x48080fec in S_call_body ()
  #7  0x48080b17 in perl_call_sv ()
  #8  0x481d1cd9 in XS_DBI_dispatch ()
  #9  0x480c8178 in Perl_pp_entersub ()
  #10 0x480c26f1 in Perl_runops_standard ()
  #11 0x48080fec in S_call_body ()
  #12 0x48080b17 in perl_call_sv ()
  #13 0x481d1cd9 in XS_DBI_dispatch ()
  #14 0x480c8178 in Perl_pp_entersub ()
  #15 0x480c26f1 in Perl_runops_standard ()
  #16 0x48080662 in S_run_body ()
  #17 0x48080378 in perl_run ()
  #18 0x804962f in main ()
  #19 0x8049379 in ___start ()
  (gdb)

Core 3:
  (gdb) where
  #0  0x480be9ef in S_more_he ()
  #1  0x480be97c in S_new_he ()
  #2  0x480bf1d1 in Perl_hv_store_ent ()
  #3  0x480beda7 in Perl_hv_fetch_ent ()
  #4  0x480c5db8 in Perl_pp_helem ()
  #5  0x480c26f1 in Perl_runops_standard ()
  #6  0x48080fec in S_call_body ()
  #7  0x48080b17 in perl_call_sv ()
  #8  0x481d1cd9 in XS_DBI_dispatch ()
  #9  0x480c8178 in Perl_pp_entersub ()
  #10 0x480c26f1 in Perl_runops_standard ()
  #11 0x48080662 in S_run_body ()
  #12 0x48080378 in perl_run ()
  #13 0x804962f in main ()
  #14 0x8049379 in ___start ()
  (gdb)




Re: DBD-Pg Segmentation Fault

2001-10-08 Thread Alex Pilosov

Result here: (I put iteration number in output)

55361
55362
55363
55364
55365
Out of memory!
Out of memory!
Callback called exit.
Out of memory!

I'm using a bit old copy of DBD::Pg, but I don't think it makes a
difference. Please check that you have ample memory, and no ulimit in
effect when you run this program. If nothing helps, do a 'where' on
coredump, that should help.

(gdb perl core, then 'where')

-alex

On Thu, 4 Oct 2001, Matt Nelson wrote:

 
 I have come up with a small perl script which consistently causes a
 segmentation fault using DBD-Pg. I have included it below, along with
 collected version information.
 
  - Matt
 
 PS - The DBD-Pg README has an invalid email address for bug reports
 PPS - http://dbi.symbolstone.org/index.html has outdated links to the
   DBI mailing lists
 
 -
 
 #!/usr/bin/env perl
 
 require 5.6.0;
 use strict;
 use warnings;
 
 require DBI;
 
 my $dbname = name;
 my $dbuser = user;
 # CREATE TABLE test (name CHARACTER VARYING(16));
 my $table = test;
 
 my $db = 0;
 $db = DBI-connect(dbi:Pg:dbname=$dbname, $dbuser, 0, { AutoCommit = 0 });
 die Cannot open database if ($db == 0);
 
 my $name = a;
 while (1) {
 my $q = INSERT INTO $table (name) VALUES (' . $name++ . ');  
 my $sf = $db-prepare_cached($q, undef, 1);
 die cannot prepare query $q if (!$sf);
 my $rv = $sf-execute();
 die cannot execute $q if (!$rv);
 }
 
 __END__
 
 $ perl -v
 
 This is perl, v5.6.0 built for i386-netbsd
 
 Copyright 1987-2000, Larry Wall
 
 Perl may be copied only under the terms of either the Artistic License or the
 GNU General Public License, which may be found in the Perl 5.0 source kit.
 
 Complete documentation for Perl, including FAQ lists, should be found on
 this system using `man perl' or `perldoc perl'.  If you have access to the
 Internet, point your browser at http://www.perl.com/, the Perl Home Page.
 
 $ perl -V
 Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
   Platform:
 osname=netbsd, osvers=1.5_alpha2, archname=i386-netbsd
 uname='netbsd build-00.gdib.nominum.com 1.5_alpha2 netbsd 1.5_alpha2 (from 
generic-1.354.2.8 $revision: 1.4 $) #0: tue oct 3 08:21:29 utc 2000 
[EMAIL PROTECTED]:u0srcsysarchi386compileibm1g i386 '
 config_args='-sde -Dprefix=/usr/pkg -Doptimize=-O2 -Darchname=i386-netbsd 
-Dcc=gcc -Dusemymalloc=false -Duseshrplib=true'
 hint=recommended, useposix=true, d_sigaction=define
 usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
 useperlio=undef d_sfio=undef uselargefiles=define 
 use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
   Compiler:
 cc='gcc', optimize='-O2', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release)
 cppflags='-fno-strict-aliasing -I/usr/pkg/include'
 ccflags ='-fno-strict-aliasing -I/usr/pkg/include'
 stdchar='char', d_stdstdio=undef, usevfork=false
 intsize=4, longsize=4, ptrsize=4, doublesize=8
 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, usemymalloc=n, prototype=define
   Linker and Libraries:
 ld='gcc', ldflags =' -L/usr/pkg/lib'
 libpth=/usr/pkg/lib /usr/lib
 libs=-lm -lcrypt
 libc=/usr/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
   Dynamic Linking:
 dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E 
-Wl,-R/usr/pkg/lib  -Wl,-R/usr/pkg/lib/perl5/5.6.0/i386-netbsd/CORE'
 cccdlflags='-DPIC -fPIC ', lddlflags='--whole-archive -shared  -L/usr/pkg/lib'
 
 
 Characteristics of this binary (from libperl): 
   Compile-time options: USE_LARGE_FILES
   Built under netbsd
   Compiled at Oct 10 2000 17:15:13
   @INC:
 /usr/pkg/lib/perl5/5.6.0/i386-netbsd
 /usr/pkg/lib/perl5/5.6.0
 /usr/pkg/lib/perl5/site_perl/5.6.0/i386-netbsd
 /usr/pkg/lib/perl5/site_perl/5.6.0
 /usr/pkg/lib/perl5/site_perl
 .
 $ psql name user
 Welcome to psql, the PostgreSQL interactive terminal.
 
 Type:  \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
 
 gns= select version();
version
 --
  PostgreSQL 7.1.2 on i386--netbsd, compiled by GCC egcs-1.1.2
 (1 row)
 
 gns= \q
 $ perl -MDBD::Pg -le 'print $DBD::Pg::VERSION'
 1.00
 $ perl -MDBI -le 'print $DBI::VERSION'
 1.18
 
 




DBD-Pg Segmentation Fault

2001-10-06 Thread Matt Nelson


I have come up with a small perl script which consistently causes a
segmentation fault using DBD-Pg. I have included it below, along with
collected version information.

 - Matt

PS - The DBD-Pg README has an invalid email address for bug reports
PPS - http://dbi.symbolstone.org/index.html has outdated links to the
  DBI mailing lists

-

#!/usr/bin/env perl

require 5.6.0;
use strict;
use warnings;

require DBI;

my $dbname = name;
my $dbuser = user;
# CREATE TABLE test (name CHARACTER VARYING(16));
my $table = test;

my $db = 0;
$db = DBI-connect(dbi:Pg:dbname=$dbname, $dbuser, 0, { AutoCommit = 0 });
die Cannot open database if ($db == 0);

my $name = a;
while (1) {
my $q = INSERT INTO $table (name) VALUES (' . $name++ . ');  
my $sf = $db-prepare_cached($q, undef, 1);
die cannot prepare query $q if (!$sf);
my $rv = $sf-execute();
die cannot execute $q if (!$rv);
}

__END__

$ perl -v

This is perl, v5.6.0 built for i386-netbsd

Copyright 1987-2000, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

$ perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
osname=netbsd, osvers=1.5_alpha2, archname=i386-netbsd
uname='netbsd build-00.gdib.nominum.com 1.5_alpha2 netbsd 1.5_alpha2 (from 
generic-1.354.2.8 $revision: 1.4 $) #0: tue oct 3 08:21:29 utc 2000 
[EMAIL PROTECTED]:u0srcsysarchi386compileibm1g i386 '
config_args='-sde -Dprefix=/usr/pkg -Doptimize=-O2 -Darchname=i386-netbsd -Dcc=gcc 
-Dusemymalloc=false -Duseshrplib=true'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define 
use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
cc='gcc', optimize='-O2', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release)
cppflags='-fno-strict-aliasing -I/usr/pkg/include'
ccflags ='-fno-strict-aliasing -I/usr/pkg/include'
stdchar='char', d_stdstdio=undef, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
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, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='gcc', ldflags =' -L/usr/pkg/lib'
libpth=/usr/pkg/lib /usr/lib
libs=-lm -lcrypt
libc=/usr/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E 
-Wl,-R/usr/pkg/lib  -Wl,-R/usr/pkg/lib/perl5/5.6.0/i386-netbsd/CORE'
cccdlflags='-DPIC -fPIC ', lddlflags='--whole-archive -shared  -L/usr/pkg/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: USE_LARGE_FILES
  Built under netbsd
  Compiled at Oct 10 2000 17:15:13
  @INC:
/usr/pkg/lib/perl5/5.6.0/i386-netbsd
/usr/pkg/lib/perl5/5.6.0
/usr/pkg/lib/perl5/site_perl/5.6.0/i386-netbsd
/usr/pkg/lib/perl5/site_perl/5.6.0
/usr/pkg/lib/perl5/site_perl
.
$ psql name user
Welcome to psql, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
   \h for help with SQL commands
   \? for help on internal slash commands
   \g or terminate with semicolon to execute query
   \q to quit

gns= select version();
   version
--
 PostgreSQL 7.1.2 on i386--netbsd, compiled by GCC egcs-1.1.2
(1 row)

gns= \q
$ perl -MDBD::Pg -le 'print $DBD::Pg::VERSION'
1.00
$ perl -MDBI -le 'print $DBI::VERSION'
1.18