Re: Postgres connection errors

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tim Uckun <timuckun(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres connection errors
Date: 2010-11-02 23:09:00
Message-ID: 18835.1288739340@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tim Uckun <timuckun(at)gmail(dot)com> writes:
> I have lots of ruby daemons running connected to postgres. Some of
> them start getting connection errors after about a day or two of
> running. The odd thing is that they don't all get the same error.

> Some get this error: PGError: lost synchronization with server: got
> message type "T"
> Others get this PGError: lost synchronization with server:
> got message type "e"
> And sometimes this PGError: lost synchronization with server: got
> message type ""

> What is postgres trying to tell me here?

Most of the cases we've seen like that have been because multiple
threads in the client application were trying to use the same PGconn
connection object concurrently. There's no cross-thread synchronization
built into libpq, so you have to provide the interlocks yourself if
there's any possibility of multiple threads touching the same PGconn
concurrently. And it will not support more than one query at a time
in any case.

But having said that ... usually apps that have made this type of
mistake start falling over almost immediately. Maybe you have a case
where it's mostly interlocked correctly, and you just missed one
infrequent code path?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2010-11-02 23:11:57 Re: JDBC Transactions
Previous Message Raymond O'Donnell 2010-11-02 23:04:37 Re: 8.4 Data Not Compatible with 9.0.1 Upgrade?