X-Original-To: pgsql-general-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 032BD9FA5F0; Tue, 20 Jun 2006 11:20:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 43942-05; Tue, 20 Jun 2006 11:20:26 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from rhws.home.edu (duck.3times25.net [66.23.211.34]) by postgresql.org (Postfix) with ESMTP id 8D5DA9FA219; Tue, 20 Jun 2006 11:20:26 -0300 (ADT) Received: from [127.0.0.1] (localhost [127.0.0.1]) by rhws.home.edu (8.13.1/8.13.1) with ESMTP id k5KEKJ1s003544; Tue, 20 Jun 2006 10:20:19 -0400 Message-ID: <44980423.7080109@3times25.net> Date: Tue, 20 Jun 2006 10:20:19 -0400 From: Geoffrey User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: pgsql-general@postgresql.org, pgsql-interfaces@postgresql.org Subject: Re: help with error message from perl Pg References: <4497F919.7050203@3times25.net> <20060620135945.GB25678@svana.org> In-Reply-To: <20060620135945.GB25678@svana.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/800 X-Sequence-Number: 97172 Martijn van Oosterhout wrote: > On Tue, Jun 20, 2006 at 09:33:13AM -0400, Geoffrey wrote: >> We have an unusual problem with some perl code that is processing data >> via DBD facility. Basically, the code consists of various subroutines >> that are identified in a hash. The primary script then references the >> subroutines through a &$prog(...) syntax. What appears to happen is >> that all subroutines will run just fine if they do not need to do any >> deletes or updates to the database. Any subroutine that does a delete >> or update runs fine, but the subsequent routine fails with the following >> error: >> >> prgcaphlg: FATAL: invalid frontend message type 78 > > Errors in the FE-BE protocol are usually caused by users trying to use > the same connection from multiple threads simultaneously. libpq doesn't > handle that and so ends up sending things out of order. > > Are you using threads? Not intentionally. I'm assuming I would have to specify a threaded process explicitly. > Also, the database connection, how is the handle passed around? Youre > not closing it accedently somewhere? We considered that and have verified that we are not closing it. But, the question came up, should we be passing it by reference or value? We are doing the following: my $conn = Pg::connectdb ("dbname=$db port=$port"); . . my $retVal = &$prog($conn, @args); Question is, should we be doing: my $retVal = &$prog(\$conn, @args); FYI, there's no expectation of changing $conn in anyway within the sub routines. -- Until later, Geoffrey Any society that would give up a little liberty to gain a little security will deserve neither and lose both. - Benjamin Franklin