pgsql: Improve handling of out-of-memory in libpq.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve handling of out-of-memory in libpq.
Date: 2015-07-07 15:50:03
Message-ID: E1ZCV8F-0002QH-Fp@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve handling of out-of-memory in libpq.

If an allocation fails in the main message handling loop, pqParseInput3
or pqParseInput2, it should not be treated as "not enough data available
yet". Otherwise libpq will wait indefinitely for more data to arrive from
the server, and gets stuck forever.

This isn't a complete fix - getParamDescriptions and getCopyStart still
have the same issue, but it's a step in the right direction.

Michael Paquier and me. Backpatch to all supported versions.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/fcdac561405e14e1ce9f8c07a53e7d4983afa7a0

Modified Files
--------------
src/interfaces/libpq/fe-protocol2.c | 51 ++++++++++++++++++++--------
src/interfaces/libpq/fe-protocol3.c | 63 +++++++++++++++++++++++++----------
2 files changed, 83 insertions(+), 31 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-07-07 15:55:07 pgsql: Oops, PQExpBufferDataBroken doesn't exist before 9.2.
Previous Message Fujii Masao 2015-07-07 14:34:53 pgsql: Add tab-completion for psql meta-commands.