pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix error handling with threads on OOM in ECPG connection logic
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix error handling with threads on OOM in ECPG connection logic
@ 2021-09-13 04:26  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2021-09-13 04:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling with threads on OOM in ECPG connection logic

An out-of-memory failure happening when allocating the structures to
store the connection parameter keywords and values would mess up with
the set of connections saved, as on failure the pthread mutex would
still be hold with the new connection object listed but free()'d.

Rather than just unlocking the mutex, which would leave the static list
of connections into an inconsistent state, move the allocation for the
structures of the connection parameters before beginning the test
manipulation.  This ensures that the list of connections and the
connection mutex remain consistent all the time in this code path.

This error is unlikely going to happen, but this could mess up badly
with ECPG clients in surprising ways, so backpatch all the way down.

Reported-by: ryancaicse
Discussion: https://postgr.es/m/17186-b4cfd8f0eb4d1dee@postgresql.org
Backpatch-through: 9.6

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fa703b317e9d261ffd34bbf5651ea29aff3ff0f0

Modified Files
--------------
src/interfaces/ecpg/ecpglib/connect.c | 71 +++++++++++++++++++----------------
1 file changed, 39 insertions(+), 32 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix error handling with threads on OOM in ECPG connection logic
@ 2021-09-13 04:26  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2021-09-13 04:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling with threads on OOM in ECPG connection logic

An out-of-memory failure happening when allocating the structures to
store the connection parameter keywords and values would mess up with
the set of connections saved, as on failure the pthread mutex would
still be hold with the new connection object listed but free()'d.

Rather than just unlocking the mutex, which would leave the static list
of connections into an inconsistent state, move the allocation for the
structures of the connection parameters before beginning the test
manipulation.  This ensures that the list of connections and the
connection mutex remain consistent all the time in this code path.

This error is unlikely going to happen, but this could mess up badly
with ECPG clients in surprising ways, so backpatch all the way down.

Reported-by: ryancaicse
Discussion: https://postgr.es/m/17186-b4cfd8f0eb4d1dee@postgresql.org
Backpatch-through: 9.6

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cc057fb315e24b78552f5b7ac05792418042e71b

Modified Files
--------------
src/interfaces/ecpg/ecpglib/connect.c | 71 +++++++++++++++++++----------------
1 file changed, 39 insertions(+), 32 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix error handling with threads on OOM in ECPG connection logic
@ 2021-09-13 04:26  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2021-09-13 04:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling with threads on OOM in ECPG connection logic

An out-of-memory failure happening when allocating the structures to
store the connection parameter keywords and values would mess up with
the set of connections saved, as on failure the pthread mutex would
still be hold with the new connection object listed but free()'d.

Rather than just unlocking the mutex, which would leave the static list
of connections into an inconsistent state, move the allocation for the
structures of the connection parameters before beginning the test
manipulation.  This ensures that the list of connections and the
connection mutex remain consistent all the time in this code path.

This error is unlikely going to happen, but this could mess up badly
with ECPG clients in surprising ways, so backpatch all the way down.

Reported-by: ryancaicse
Discussion: https://postgr.es/m/17186-b4cfd8f0eb4d1dee@postgresql.org
Backpatch-through: 9.6

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b589d212fdd7e449ec0d5da8e46c0d86eee943d6

Modified Files
--------------
src/interfaces/ecpg/ecpglib/connect.c | 71 +++++++++++++++++++----------------
1 file changed, 39 insertions(+), 32 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix error handling with threads on OOM in ECPG connection logic
@ 2021-09-13 04:26  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2021-09-13 04:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling with threads on OOM in ECPG connection logic

An out-of-memory failure happening when allocating the structures to
store the connection parameter keywords and values would mess up with
the set of connections saved, as on failure the pthread mutex would
still be hold with the new connection object listed but free()'d.

Rather than just unlocking the mutex, which would leave the static list
of connections into an inconsistent state, move the allocation for the
structures of the connection parameters before beginning the test
manipulation.  This ensures that the list of connections and the
connection mutex remain consistent all the time in this code path.

This error is unlikely going to happen, but this could mess up badly
with ECPG clients in surprising ways, so backpatch all the way down.

Reported-by: ryancaicse
Discussion: https://postgr.es/m/17186-b4cfd8f0eb4d1dee@postgresql.org
Backpatch-through: 9.6

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b34dcf87f685ab6c7705d4dd504f23025bfc75b0

Modified Files
--------------
src/interfaces/ecpg/ecpglib/connect.c | 71 +++++++++++++++++++----------------
1 file changed, 39 insertions(+), 32 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix error handling with threads on OOM in ECPG connection logic
@ 2021-09-13 04:26  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2021-09-13 04:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling with threads on OOM in ECPG connection logic

An out-of-memory failure happening when allocating the structures to
store the connection parameter keywords and values would mess up with
the set of connections saved, as on failure the pthread mutex would
still be hold with the new connection object listed but free()'d.

Rather than just unlocking the mutex, which would leave the static list
of connections into an inconsistent state, move the allocation for the
structures of the connection parameters before beginning the test
manipulation.  This ensures that the list of connections and the
connection mutex remain consistent all the time in this code path.

This error is unlikely going to happen, but this could mess up badly
with ECPG clients in surprising ways, so backpatch all the way down.

Reported-by: ryancaicse
Discussion: https://postgr.es/m/17186-b4cfd8f0eb4d1dee@postgresql.org
Backpatch-through: 9.6

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b6a10ff4abe9538f16d9f52bda6bc04f90b77d0d

Modified Files
--------------
src/interfaces/ecpg/ecpglib/connect.c | 71 +++++++++++++++++++----------------
1 file changed, 39 insertions(+), 32 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix error handling with threads on OOM in ECPG connection logic
@ 2021-09-13 04:26  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2021-09-13 04:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling with threads on OOM in ECPG connection logic

An out-of-memory failure happening when allocating the structures to
store the connection parameter keywords and values would mess up with
the set of connections saved, as on failure the pthread mutex would
still be hold with the new connection object listed but free()'d.

Rather than just unlocking the mutex, which would leave the static list
of connections into an inconsistent state, move the allocation for the
structures of the connection parameters before beginning the test
manipulation.  This ensures that the list of connections and the
connection mutex remain consistent all the time in this code path.

This error is unlikely going to happen, but this could mess up badly
with ECPG clients in surprising ways, so backpatch all the way down.

Reported-by: ryancaicse
Discussion: https://postgr.es/m/17186-b4cfd8f0eb4d1dee@postgresql.org
Backpatch-through: 9.6

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/83a3737a63a52a006c3f1290cda25acbda3607fa

Modified Files
--------------
src/interfaces/ecpg/ecpglib/connect.c | 71 +++++++++++++++++++----------------
1 file changed, 39 insertions(+), 32 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix error handling with threads on OOM in ECPG connection logic
@ 2021-09-13 04:26  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2021-09-13 04:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix error handling with threads on OOM in ECPG connection logic

An out-of-memory failure happening when allocating the structures to
store the connection parameter keywords and values would mess up with
the set of connections saved, as on failure the pthread mutex would
still be hold with the new connection object listed but free()'d.

Rather than just unlocking the mutex, which would leave the static list
of connections into an inconsistent state, move the allocation for the
structures of the connection parameters before beginning the test
manipulation.  This ensures that the list of connections and the
connection mutex remain consistent all the time in this code path.

This error is unlikely going to happen, but this could mess up badly
with ECPG clients in surprising ways, so backpatch all the way down.

Reported-by: ryancaicse
Discussion: https://postgr.es/m/17186-b4cfd8f0eb4d1dee@postgresql.org
Backpatch-through: 9.6

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3768c468df58ed23588e93c37c94a716116f0cd8

Modified Files
--------------
src/interfaces/ecpg/ecpglib/connect.c | 71 +++++++++++++++++++----------------
1 file changed, 39 insertions(+), 32 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2021-09-13 04:26 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 04:26 pgsql: Fix error handling with threads on OOM in ECPG connection logic Michael Paquier <michael@paquier.xyz>
2021-09-13 04:26 pgsql: Fix error handling with threads on OOM in ECPG connection logic Michael Paquier <michael@paquier.xyz>
2021-09-13 04:26 pgsql: Fix error handling with threads on OOM in ECPG connection logic Michael Paquier <michael@paquier.xyz>
2021-09-13 04:26 pgsql: Fix error handling with threads on OOM in ECPG connection logic Michael Paquier <michael@paquier.xyz>
2021-09-13 04:26 pgsql: Fix error handling with threads on OOM in ECPG connection logic Michael Paquier <michael@paquier.xyz>
2021-09-13 04:26 pgsql: Fix error handling with threads on OOM in ECPG connection logic Michael Paquier <michael@paquier.xyz>
2021-09-13 04:26 pgsql: Fix error handling with threads on OOM in ECPG connection logic Michael Paquier <michael@paquier.xyz>

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