Re: pqReadData() -- read() failed: errno=32

From: "Craig Stratton" <craig(at)avnet(dot)co(dot)uk>
To: "Richard Huxton" <dev(at)archonet(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: pqReadData() -- read() failed: errno=32
Date: 2003-12-18 14:30:55
Message-ID: 001b01c3c573$8e660f30$0314a8c0@cpsws
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> > I get this error, as in subject:-
> > pqReadData() -- read() failed: errno=32
> > and then followed by this
> > pqReadData() -- backend closed the channel unexpectedly.
> >
> > I can find no reference to errno=32 in the mailing lists.
>
> From memory and google, it's a broken pipe, traditionally from php's
> persistent connections. Assuming a backend isn't dying, I'm a bit puzzled.
> Check your logs and see if all is OK.

This is running as a cgi script, not php. The backend dies afterwards.
I think it is dbi/thread/child related, so i modified the code, but still no
joy.
I am fairly sure its dbi thread related still though.

>
> > If i define and connect the database handle within the function that
does
> > my processing, then i get no errors (but very slow processing due to
> > connecting on each event).
> >
> > If i define and connect the database handle as a global variable
outside
> > of the function, then i get that error on the first insert.
>
> Can you give a short example of what works and what doesn't.

1) connect within sub
my $dbv;
sub SQLLogging {
$dbv = DBI->connect("DBI:Pg:dbname=dbv","admin", "", {'PrintError' => 0});
and then all following inserts work fine

2) connect outside of sub
my $dbv;
$dbv = DBI->connect("DBI:Pg:dbname=dbv","admin", "", {'PrintError' => 0});
sub SQLLogging {
and then i get the error on the first insert attempt

3) connect outside, connect inside if not defined (in case missed by thread
fork)
my $dbv;
$dbv = DBI->connect("DBI:Pg:dbname=dbv","admin", "", {'PrintError' => 0});
sub SQLLogging {
unless(defined($dbv)){
$dbv = DBI->connect("DBI:Pg:dbname=dbv","admin", "", {'PrintError' =>
0});
}
this gives me the same problem as (2)

I didn't write the rest of the script, only the logging routine, so until i
go back and study the code, i am not sure where the fork(s) happen.
I was hoping that the errno=32 would give a clear indication that there was
a client/connection problem to follow up.

Regards
Craig

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2003-12-18 14:48:32 Re: pqReadData() -- read() failed: errno=32
Previous Message Shridhar Daithankar 2003-12-18 13:42:25 Re: Which file system do i have to choose?