Re: 08P01: unexpected EOF on client connection - Mailing list pgsql-general

From Tomas Vondra
Subject Re: 08P01: unexpected EOF on client connection
Date
Msg-id 49FB7773.5050003@fuzzy.cz
Whole thread Raw
In response to Re: 08P01: unexpected EOF on client connection  (Craig Ringer <craig@postnewspapers.com.au>)
List pgsql-general
Hi,

> Tomas Vondra wrote:
>
>> $conn = pg_connect(...);
>> $res = pg_query("SELECT mime, thumbnail_data FROM images WHERE filename
>> = ....");
>> $row = pg_fetch_assoc($row);
>> header('Content-Type: ' . $row['mime']);
>> echo pg_unescape_bytea($row['thumbnail_data']);
>
> PHP?
>
> Try running your script in a PHP debugger (from the command line or, if
> your server supports it, while hosted) and see at what point exactly
> things go pear shaped. Check your web server error log for any client
> library or PHP errors, too.

Running in a PHP debugger would be quite difficult in this case, as the
script is executed concurrently - once for each image displayed on the
page and requested by the browser.

> Even just adding a bunch of logging statements into your script then
> looking at your web server error log might help you a little.

I've added some logging into the script - basically there are 4
interesting places, and for a page with 69 images, the results are these
(number of executions that reach the point):

1) before connect : 69 cases
2) after connect / before select : 32 cases
3) after select : 24 cases
4) at the end : 24 cases

So only about 30% of the images is actually drawn. About 50% of the
executions fail right at the connection, and another 8 fail when
fetching the data :-(

Anyway it seems there's something wrong with my development box. I've
tried to run this app on a production server and everything works fine
there (all the images displayed, no 'unexpected EOF' errors etc).

The production box is not exactly the same, but in general the versions
of PHP, PostgreSQL and Apache do match. OK, this is probably the
punishment for living on the edge as I use gentoo (instead of debian,
installed on the server). But how to find out the rotten piece?

regards
Tomas

pgsql-general by date:

Previous
From: Adam B
Date:
Subject: Re: Possible to prevent transaction abort?
Next
From: rwade@uci.edu
Date:
Subject: function in pgAdmin