Re: Postgres connection failures - Mailing list pgsql-general

From Tom Lane
Subject Re: Postgres connection failures
Date
Msg-id 5832.1396620552@sss.pgh.pa.us
Whole thread Raw
In response to Postgres connection failures  (Mark van Cuijk <postgresql.org-pgsql-general-41@45cents.nl>)
Responses Re: Postgres connection failures  (Mark van Cuijk <postgresql.org-pgsql-general-41@45cents.nl>)
List pgsql-general
Mark van Cuijk <postgresql.org-pgsql-general-41@45cents.nl> writes:
> I�m developing an application using Postgres and when doing a transaction with a bunch of INSERT statements, the
connectionto the server (on localhost) often suddenly dies. Trying to diagnose the problem, I�ve increased log levels
andI�ve run a tcpdump session to find out what�s going on, can someone spot something strange or point me in a
directionto continue debugging? 

> The symptom I notice is that the Postgres server (9.1 from Ubuntu repo) closes the connection, sometimes by sending a
TCPFIN, sometimes by sending a TCP RST, but I�m not sure why this happens. The (node.js / node-postgres-pure) client
doesn�treport any error message that could have been received from the server; it only complains that the connection
unexpectedlyclosed during query execution. 

Your log extract looks like the server side thought it got a connection
closure command.  In particular, the server process seems to have exited
normally, and it did not write "LOG:  unexpected EOF on client connection",
which it would have done if the TCP connection dropped without receipt of
such a command.

Based on these facts, I'm going to speculate that your client application
is multi-threaded and some thread is closing a connection out from under
another one.  It's usually best to have only one thread touching a
particular connection; or if you want to maintain a connection pool
yourself, be very sure you have clear acquire and release rules.

            regards, tom lane


pgsql-general by date:

Previous
From: Mark van Cuijk
Date:
Subject: Postgres connection failures
Next
From: Mark van Cuijk
Date:
Subject: Re: Postgres connection failures