| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | Mark van Cuijk <postgresql(dot)org-pgsql-general-41(at)45cents(dot)nl> | 
| Cc: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: Postgres connection failures | 
| Date: | 2014-04-04 14:09:12 | 
| Message-ID: | 5832.1396620552@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Mark van Cuijk <postgresql(dot)org-pgsql-general-41(at)45cents(dot)nl> writes:
> Im developing an application using Postgres and when doing a transaction with a bunch of INSERT statements, the connection to the server (on localhost) often suddenly dies. Trying to diagnose the problem, Ive increased log levels and Ive run a tcpdump session to find out whats going on, can someone spot something strange or point me in a direction to continue debugging?
> The symptom I notice is that the Postgres server (9.1 from Ubuntu repo) closes the connection, sometimes by sending a TCP FIN, sometimes by sending a TCP RST, but Im not sure why this happens. The (node.js / node-postgres-pure) client doesnt report any error message that could have been received from the server; it only complains that the connection unexpectedly closed 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Emmanuel Medernach | 2014-04-04 14:40:42 | UDF calls and FDW | 
| Previous Message | Mark van Cuijk | 2014-04-04 13:55:53 | Postgres connection failures |