pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Make GetSnapshotData() more resilient on out-of-memory errors
8+ messages / 2 participants
[nested] [flat]
Commits from this thread:
2026-11-12 94641eda4c bdae2f8eaa a123cc8429 d06780d4dd Make GetSnapshotData() more resilient on out-of-memory errors
* pgsql: Make GetSnapshotData() more resilient on out-of-memory errors
@ 2026-06-18 05:14 Michael Paquier <michael@paquier.xyz>
2026-11-09 08:26 ` Re: pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Aleksander Alekseev <aleksander@tigerdata.com>
0 siblings, 1 reply; 8+ messages in thread
From: Michael Paquier @ 2026-06-18 05:14 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Make GetSnapshotData() more resilient on out-of-memory errors
If the allocation of Snapshot->subxip fails, a follow-up call of
GetSnapshotData() would see a partially-initialized snapshot, causing a
NULL dereference on reentry when using "subxip" because only "xip" would
be allocated. In the event of an out-of-memory error when allocating
"subxip", "xip" is now reset before throwing an ERROR, so as Snapshots
can be allocated and handled gracefully on retry.
This problem is unlikely going to show up in practice, so no backpatch.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/e77acaac-a1b3-40b3-99ee-5769b4e453e4@gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/29fb598b9cad898ef851b9a7704f980218057562
Modified Files
--------------
src/backend/storage/ipc/procarray.c | 8 ++++++++
1 file changed, 8 insertions(+)
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pgsql: Make GetSnapshotData() more resilient on out-of-memory errors
2026-06-18 05:14 pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Michael Paquier <michael@paquier.xyz>
@ 2026-11-09 08:26 ` Aleksander Alekseev <aleksander@tigerdata.com>
2026-11-10 04:55 ` Re: pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 8+ messages in thread
From: Aleksander Alekseev @ 2026-11-09 08:26 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org; +Cc: Michael Paquier <michael@paquier.xyz>
Hi Michael,
> This problem is unlikely going to show up in practice, so no backpatch.
A customer reported offlist that the issue is reproducible in practice
on PostgreSQL 18. I suggest backpatching this.
--
Best regards,
Aleksander Alekseev
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pgsql: Make GetSnapshotData() more resilient on out-of-memory errors
2026-06-18 05:14 pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Michael Paquier <michael@paquier.xyz>
2026-11-09 08:26 ` Re: pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Aleksander Alekseev <aleksander@tigerdata.com>
@ 2026-11-10 04:55 ` Michael Paquier <michael@paquier.xyz>
2026-11-12 06:02 ` Re: pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 8+ messages in thread
From: Michael Paquier @ 2026-11-10 04:55 UTC (permalink / raw)
To: Aleksander Alekseev <aleksander@tigerdata.com>; +Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
On Mon, Nov 09, 2026 at 11:26:50AM +0300, Aleksander Alekseev wrote:
> A customer reported offlist that the issue is reproducible in practice
> on PostgreSQL 18. I suggest backpatching this.
I would not mind. Any concerns from others?
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pgsql: Make GetSnapshotData() more resilient on out-of-memory errors
2026-06-18 05:14 pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Michael Paquier <michael@paquier.xyz>
2026-11-09 08:26 ` Re: pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Aleksander Alekseev <aleksander@tigerdata.com>
2026-11-10 04:55 ` Re: pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Michael Paquier <michael@paquier.xyz>
@ 2026-11-12 06:02 ` Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 8+ messages in thread
From: Michael Paquier @ 2026-11-12 06:02 UTC (permalink / raw)
To: Aleksander Alekseev <aleksander@tigerdata.com>; +Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
On Tue, Nov 10, 2026 at 01:55:29PM +0900, Michael Paquier wrote:
> I would not mind. Any concerns from others?
Done this one down to v15. Thanks for the feedback.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Make GetSnapshotData() more resilient on out-of-memory errors
@ 2026-11-12 06:01 Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 8+ messages in thread
From: Michael Paquier @ 2026-11-12 06:01 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Make GetSnapshotData() more resilient on out-of-memory errors
If the allocation of Snapshot->subxip fails, a follow-up call of
GetSnapshotData() would see a partially-initialized snapshot, causing a
NULL dereference on reentry when using "subxip" because only "xip" would
be allocated. In the event of an out-of-memory error when allocating
"subxip", "xip" is now reset before throwing an ERROR, so as Snapshots
can be allocated and handled gracefully on retry.
Note: This has been originally applied in v19~ as of 29fb598b9cad, and
was initially not backpatched. This issue has been seen in the field on
older stable branches, hence the backpatch now.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/e77acaac-a1b3-40b3-99ee-5769b4e453e4@gmail.com
Discussion: https://postgr.es/m/CAJ7c6TO+7rrN5H_Odd8PLdmrEa4MgeoJ2AqnTydOcy=AyZvDsQ@mail.gmail.com
Backpatch-through: 15
Branch
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/94641eda4c6293fa43b44ff8c7433b510f4bcfa5
Modified Files
--------------
src/backend/storage/ipc/procarray.c | 8 ++++++++
1 file changed, 8 insertions(+)
^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Make GetSnapshotData() more resilient on out-of-memory errors
@ 2026-11-12 06:01 Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 8+ messages in thread
From: Michael Paquier @ 2026-11-12 06:01 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Make GetSnapshotData() more resilient on out-of-memory errors
If the allocation of Snapshot->subxip fails, a follow-up call of
GetSnapshotData() would see a partially-initialized snapshot, causing a
NULL dereference on reentry when using "subxip" because only "xip" would
be allocated. In the event of an out-of-memory error when allocating
"subxip", "xip" is now reset before throwing an ERROR, so as Snapshots
can be allocated and handled gracefully on retry.
Note: This has been originally applied in v19~ as of 29fb598b9cad, and
was initially not backpatched. This issue has been seen in the field on
older stable branches, hence the backpatch now.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/e77acaac-a1b3-40b3-99ee-5769b4e453e4@gmail.com
Discussion: https://postgr.es/m/CAJ7c6TO+7rrN5H_Odd8PLdmrEa4MgeoJ2AqnTydOcy=AyZvDsQ@mail.gmail.com
Backpatch-through: 15
Branch
------
REL_17_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/bdae2f8eaab09222dc4e3562d712e6580711ccf9
Modified Files
--------------
src/backend/storage/ipc/procarray.c | 8 ++++++++
1 file changed, 8 insertions(+)
^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Make GetSnapshotData() more resilient on out-of-memory errors
@ 2026-11-12 06:01 Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 8+ messages in thread
From: Michael Paquier @ 2026-11-12 06:01 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Make GetSnapshotData() more resilient on out-of-memory errors
If the allocation of Snapshot->subxip fails, a follow-up call of
GetSnapshotData() would see a partially-initialized snapshot, causing a
NULL dereference on reentry when using "subxip" because only "xip" would
be allocated. In the event of an out-of-memory error when allocating
"subxip", "xip" is now reset before throwing an ERROR, so as Snapshots
can be allocated and handled gracefully on retry.
Note: This has been originally applied in v19~ as of 29fb598b9cad, and
was initially not backpatched. This issue has been seen in the field on
older stable branches, hence the backpatch now.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/e77acaac-a1b3-40b3-99ee-5769b4e453e4@gmail.com
Discussion: https://postgr.es/m/CAJ7c6TO+7rrN5H_Odd8PLdmrEa4MgeoJ2AqnTydOcy=AyZvDsQ@mail.gmail.com
Backpatch-through: 15
Branch
------
REL_16_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/a123cc8429c0c07834b8d6a97b99d05eeb8e012e
Modified Files
--------------
src/backend/storage/ipc/procarray.c | 8 ++++++++
1 file changed, 8 insertions(+)
^ permalink raw reply [nested|flat] 8+ messages in thread
* pgsql: Make GetSnapshotData() more resilient on out-of-memory errors
@ 2026-11-12 06:01 Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 8+ messages in thread
From: Michael Paquier @ 2026-11-12 06:01 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Make GetSnapshotData() more resilient on out-of-memory errors
If the allocation of Snapshot->subxip fails, a follow-up call of
GetSnapshotData() would see a partially-initialized snapshot, causing a
NULL dereference on reentry when using "subxip" because only "xip" would
be allocated. In the event of an out-of-memory error when allocating
"subxip", "xip" is now reset before throwing an ERROR, so as Snapshots
can be allocated and handled gracefully on retry.
Note: This has been originally applied in v19~ as of 29fb598b9cad, and
was initially not backpatched. This issue has been seen in the field on
older stable branches, hence the backpatch now.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/e77acaac-a1b3-40b3-99ee-5769b4e453e4@gmail.com
Discussion: https://postgr.es/m/CAJ7c6TO+7rrN5H_Odd8PLdmrEa4MgeoJ2AqnTydOcy=AyZvDsQ@mail.gmail.com
Backpatch-through: 15
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/d06780d4ddab4902d61dd8f6e98b2aafc562d54f
Modified Files
--------------
src/backend/storage/ipc/procarray.c | 8 ++++++++
1 file changed, 8 insertions(+)
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2026-11-12 06:02 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-18 05:14 pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Michael Paquier <michael@paquier.xyz>
2026-11-09 08:26 ` Aleksander Alekseev <aleksander@tigerdata.com>
2026-11-10 04:55 ` Michael Paquier <michael@paquier.xyz>
2026-11-12 06:02 ` Michael Paquier <michael@paquier.xyz>
2026-11-12 06:01 pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Michael Paquier <michael@paquier.xyz>
2026-11-12 06:01 pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Michael Paquier <michael@paquier.xyz>
2026-11-12 06:01 pgsql: Make GetSnapshotData() more resilient on out-of-memory errors Michael Paquier <michael@paquier.xyz>
2026-11-12 06:01 pgsql: Make GetSnapshotData() more resilient on out-of-memory errors 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