Re: BUG #11455: PQerrorMessage not reset after PQreset

From: Caleb Epstein <cae(at)bklyn(dot)org>
To: "Tom Lane tgl-at-sss(dot)pgh(dot)pa(dot)us |postgresql-bklyn|" <uabn4z8tjt(at)sneakemail(dot)com>
Cc: postgresql-bklyn(at)sneakemail(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #11455: PQerrorMessage not reset after PQreset
Date: 2014-09-19 20:47:36
Message-ID: CABzF1r-FDx9oUMv87pPEsjzpPzAaq+50niJcvKmsKQWWEusivw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Test program (C++0x) attached. Run it with a connection info string as
argv[1]. It should print a dot once per second while the DB connection is
OK, but will print the PQerrorMessage text when the connection fails, and
then will PQreset the connection. Each time it prints the error you can
see all the previous error content and the error buffer just keeps growing
and growing rather than resetting when PQreset is called.

If instead of calling "PQreset", one calls "PQfinish" and "PQconnectdb"
(e.g. change the call from "reset" to "reconnect" on line 39), you'll
(naturally) see just the most recent error.

On Fri, Sep 19, 2014 at 3:57 PM, Tom Lane tgl-at-sss.pgh.pa.us
|postgresql-bklyn| <uabn4z8tjt(at)sneakemail(dot)com> wrote:

> postgresql-bklyn(at)sneakemail(dot)com writes:
> > I'm testing application logic to reconnect to my database server after a
> > connection failure. I'm using PQreset() and I notice that the
> > PQerrorMessage() result keeps growing after each failed reconnect.
>
> It's unlikely that anyone is going to look into this unless you provide
> a self-contained test case (ie, a small program that reproduces the
> misbehavior). It's too hard to guess exactly what you did.
>
> regards, tom lane
>

--
Caleb Epstein

Attachment Content-Type Size
libpq-error-cascade.cpp text/x-c++src 1.2 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Caleb Epstein 2014-09-19 21:12:58 Re: BUG #11455: PQerrorMessage not reset after PQreset
Previous Message Tom Lane 2014-09-19 19:57:21 Re: BUG #11455: PQerrorMessage not reset after PQreset