From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid ecpglib core dump with out-of-order operations.
Date: Tue, 14 Jun 2022 22:17:13 +0000
Message-ID: <E1o1EqX-0004yN-4f@gemulon.postgresql.org> (raw)
Avoid ecpglib core dump with out-of-order operations.
If an application executed operations like EXEC SQL PREPARE
without having first established a database connection, it could
get a core dump instead of the expected clean failure. This
occurred because we did "pthread_getspecific(actual_connection_key)"
without ever having initialized the TSD key actual_connection_key.
The results of that are probably platform-specific, but at least
on Linux it often leads to a crash.
To fix, add calls to ecpg_pthreads_init() in the code paths that
might use actual_connection_key uninitialized. It's harmless
(and hopefully inexpensive) to do that more than once.
Per bug #17514 from Okano Naoki. The problem's ancient, so
back-patch to all supported branches.
Discussion: https://postgr.es/m/17514-edd4fad547c5692c@postgresql.org
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/86258f083aad4e0900e912598790ffb0570bec17
Modified Files
--------------
src/interfaces/ecpg/ecpglib/connect.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Avoid ecpglib core dump with out-of-order operations.
In-Reply-To: <E1o1EqX-0004yN-4f@gemulon.postgresql.org>
References: <E1o1EqX-0004yN-4f@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox