Problem with locking up when running multiple processes from Perl

From: "Robert Field" <Robert_Field(at)prn(dot)com>
To: pgsql-cygwin(at)postgresql(dot)org
Subject: Problem with locking up when running multiple processes from Perl
Date: 2005-03-22 20:20:54
Message-ID: 991D71C105A6BB41BDBBFA366B2FF5C201351425@postal1.prn-corp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin

I've experienced this with both Postgres 7.4.3 and 7.4.5, using Perl
modules DBD::Pg 1.40 and DBI 1.48.

To boil it down to the simplest case:

I can run a few instances of the following program in parallel, but if I
try to run 12 in parallel the database system will lock up, so that I
can't run a psql either.

In our production system we get similar behavior.

Program follows:

**********************************

use strict;
use subs;
use integer;
use XML::Simple;
use Data::Dumper;
use Exporter;
use Proc::ProcessTable;
use POSIX;

my $db = "dbi:Pg:dbname=issp";
my $dbh = DBI->connect($db, "postgres", "p0stgr3s");

sub do_query($;$) {
my $query = shift;
my $dbh = shift;
my $own_dbh = 0;
if (! $dbh) {
my $db = "dbi:Pg:dbname=testdb";
$dbh = DBI->connect($db, "", "");
$own_dbh = 1;
}
if ($dbh) {
my $res = $dbh->do($query);
$dbh->disconnect() if $own_dbh;
defined($res) or die "DATABASE: " . $DBI::errstr . " " . $query;
return $res;

} else {
die "DATABASE: " . $DBI::errstr;
}
}

foreach (1..500) {
print STDERR "$_ ";
my $item = sprintf("l%05d", $_);
my $res = do_query("UPDATE config_vals SET config_val='$item'
WHERE ".
"config_key='ID_CODE'", $dbh);
}

$dbh->disconnect();

Browse pgsql-cygwin by date

  From Date Subject
Next Message Reini Urban 2005-03-23 17:22:03 Re: unicode support vs native install
Previous Message Peterson 2005-03-22 13:31:03 signal 12