Re: pgsql: libpq: Notice errors a backend may have sent just before dying.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: libpq: Notice errors a backend may have sent just before dying.
Date: 2015-11-12 15:46:00
Message-ID: CA+TgmoZ=6ZQk5J2tZuSVkBUjrOK-FPQMLpW4uxbdEEz6UY784Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Thu, Nov 12, 2015 at 9:29 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <rhaas(at)postgresql(dot)org> writes:
>> libpq: Notice errors a backend may have sent just before dying.
>> At least since the introduction of Hot Standby, the backend has
>> sometimes sent fatal errors even when no client query was in
>> progress, assuming that the client would receive it. However,
>> pqHandleSendFailure was not in sync with this assumption, and
>> only tries to catch notices and notifies. Add a parseInput call
>> to the loop there to fix.
>
> Just for the record, this patch changes no behavior whatsoever.

Actually, yes it does. I tested. Without the patch, the message sent
by ac1d7945f866b1928c2554c0f80fd52d7f977772 isn't received by psql.
With the patch, it is.

> It could only make a difference if the backend were still actively
> sending data, which certainly isn't so in the case claimed by the
> commit message. Moreover, removing the comment that explains why
> only NOTICE and NOTIFY messages will be eaten doesn't make it not so.

I did post an analysis of why I believe these changes are correct on
pgsql-hackers. Did you read it? If it's wrong, perhaps you could
respond to that thread. In short, the old comment is appears to me to
be factually wrong: the claim that PGASYNC_IDLE ignores everything but
NOTICE and NOTIFY is at odds with the actual behavior of
pqParseInput3.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-11-12 16:25:18 Re: pgsql: libpq: Notice errors a backend may have sent just before dying.
Previous Message Tom Lane 2015-11-12 14:29:29 Re: pgsql: libpq: Notice errors a backend may have sent just before dying.