Re: Error: no connection to the server

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'Marco Bambini *EXTERN*'" <marco(at)sqlabs(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Error: no connection to the server
Date: 2016-04-25 08:11:15
Message-ID: A737B7A37273E048B164557ADEF4A58B53844008@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Marco Bambini wrote:
> I have a multithreaded C client and sometimes I receive the "no connection to the server" error
> message.
> I haven't found any documentation about it and about how to fix this issue.
>
> Anyone can point me to the right direction?

The error message is reported in interfaces/libpq/fe-exec.c:

static bool
PQsendQueryStart(PGconn *conn)
{
if (!conn)
return false;

/* clear the error string */
resetPQExpBuffer(&conn->errorMessage);

/* Don't try to send if we know there's no live connection. */
if (conn->status != CONNECTION_OK)
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("no connection to the server\n"));
return false;
}

So it looks like you closed the connection (maybe in some other thread)
and then try to reuse it.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Wilson 2016-04-25 09:23:15 Re: Background worker plus language handler for Andl: OK?
Previous Message Marco Bambini 2016-04-25 07:58:47 Error: no connection to the server