Re: OOM in libpq and infinite loop with getCopyStart()

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: OOM in libpq and infinite loop with getCopyStart()
Date: 2016-03-22 03:54:45
Message-ID: CAA4eK1KR4NjUGAUgB4NSt8eyHd3+kgmWVJ0zZHAOE6NX5TW-rg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 21, 2016 at 10:13 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Tue, Mar 1, 2016 at 12:38 AM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
> > Thoughts? I have registered that in the CF app, and a patch is attached.
>
> It is very difficult to believe that this is a good idea:
>
> --- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
> +++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
> @@ -445,6 +445,7 @@ libpqrcv_PQexec(const char *query)
> if (PQresultStatus(lastResult) == PGRES_COPY_IN ||
> PQresultStatus(lastResult) == PGRES_COPY_OUT ||
> PQresultStatus(lastResult) == PGRES_COPY_BOTH ||
> + PQresultStatus(lastResult) == PGRES_FATAL_ERROR ||
> PQstatus(streamConn) == CONNECTION_BAD)
> break;
> }
>
> I mean, why would it be a good idea to blindly skip over fatal errors?
>

I think it is not about skipping the FATAL error, rather to stop trying to
get further results on FATAL error. This is to ensure that OOM error is
reported rather that ignored. There has been discussion about this
previously as well [1].

[1] -
http://www.postgresql.org/message-id/CAB7nPqT6gKj6iS9VTPth_h6Sz5Jo-177s6QJN_jrW66wyCjJ=w@mail.gmail.com

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2016-03-22 04:02:19 Re: Minor bug affecting ON CONFLICT lock wait log messages
Previous Message Haribabu Kommi 2016-03-22 03:43:32 Re: [HACKERS] Re: [HACKERS] Re: [HACKERS] Windows service is not starting so there’s message in log: FATAL: "could not create shared memory segment “Global/PostgreSQL.851401618”: Permission denied”