pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Duffy <jeff@alanne.com>
To: DBI Users <dbi-users@perl.org>
Cc: Postgres Interfaces <pgsql-interfaces@postgresql.org>
Cc: Edmund Mergl <e.mergl@bawue.de>
Subject: Possible bug in DBD::Pg 0.95
Date: 29 Mar 2001 12:14:07 EST
Message-ID: <200103291715.f2THFUK56050@postgresql.org> (raw)

While poking about in my favorite MUA 
(Pronto; http://muhri.net/pronto)
I discovered what may be a serious bug in DBD::Pg. While attempting
to import some files (email) into the database, the script dumped 
core.

 Some experimenting shows that smaller files (>100k or so) insert
fine, but larger file inserts into text fields cause the script to 
segfault and dump core when execute() is called on the statement 
handle. 

 I have successfully inserted the same text into Postgres using the
COPY command, so that should rule out db issues. 

The offending code:

#!/usr/bin/perl
use DBI;

my $dbh = DBI->connect("dbi:Pg:dbname='jeff'", 'jeff', '', 
 {AutoCommit => 0 });

open(FILE, 'test.msg');
undef $/;
my $msg = <FILE>;
close(FILE);

my $sth = $dbh->prepare("INSERT INTO message_sources VALUES(91, ?)");
$sth->bind_param(1, $msg);
$sth->execute();
$dbh->commit();
$dbh->disconnect;


The file test.msg is ~178k (it's a pgsql-general-digest message). 


 The table:

jeff=# \d message_sources 
    Table "message_sources"
 Attribute |  Type   | Modifier 
-----------+---------+----------
 id	   | integer | not null
 bodytext  | text    | 
Index: message_sources_pkey


The first few lines of 'strings core' suggests that there might be an
issue with DynaLoader:

tch %s%s%s%s %_
DynaLoader::dl_load_file
DynaLoader::dl_find_symbol
DynaLoader::dl_undef_symbols
DynaLoader::dl_install_xsub
DynaLoader::dl_error
"@ t
bh->disconnect;
 $msg);
ERT INTO message_sources VALUES(91, ?)");
 => 0 });


The environment:

Red Hat 7.0 (linux 2.4.2)
Perl 5.6.0 (compiled from source, shared libperl.so)
PostgreSQL 7.1RC1 (compiled from source)
DBD::Pg 0.95 (compiled from source)

 I recompiled Perl and DBD::Pg using kgcc (egcs-2.91.66) to make sure
that the RH gcc 2.96 wasn't at fault, and got the same results.

 The corefile and test message are available.

-- 
 Jeff Duffy
 Great Bridge, Inc.
 jduffy@greatbridge.com




Message-ID: <200103291715.f2THFUK56050@postgresql.org>
Permalink:  ../200103291715.f2THFUK56050@postgresql.org/
Also on:    postgresql.org/message-id/200103291715.f2THFUK56050@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: jeff@alanne.com, dbi-users@perl.org, e.mergl@bawue.de
  Subject: Re: Possible bug in DBD::Pg 0.95
  In-Reply-To: <200103291715.f2THFUK56050@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox