pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix uninitialized access to InitialRunningXacts during decoding.
10+ messages / 1 participants
[nested] [flat]

* pgsql: Fix uninitialized access to InitialRunningXacts during decoding.
@ 2022-11-25 04:17  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 10+ messages in thread

From: Amit Kapila @ 2022-11-25 04:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix uninitialized access to InitialRunningXacts during decoding.

In commit 272248a0c, we introduced an InitialRunningXacts array to
remember transactions and subtransactions that were running when the
xl_running_xacts record that we decoded was written. This array was
allocated in the snapshot builder memory context after we restore
serialized snapshot but we forgot to reset the array while freeing the
builder memory context. So, the next time when we start decoding in the
same session where we don't restore any serialized snapshot, we ended up
using the uninitialized array and that can lead to unpredictable behavior.

This problem doesn't exist in HEAD as instead of using
InitialRunningXacts, we added the list of transaction IDs and
sub-transaction IDs, that have modified catalogs and are running during
snapshot serialization, to the serialized snapshot (see commit 7f13ac8123).

Reported-by: Maxim Orlov
Author: Masahiko Sawada
Reviewed-by: Amit Kapila, Maxim Orlov
Backpatch-through: 11
Discussion: https://postgr.es/m/CACG=ezZoz_KG+Ryh9MrU_g5e0HiVoHocEvqFF=NRrhrwKmEQJQ@mail.gmail.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4ec157c15067be979d271416dacf86a5fce34cbc

Modified Files
--------------
src/backend/replication/logical/snapbuild.c | 7 +++++++
1 file changed, 7 insertions(+)



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

* pgsql: Fix uninitialized access to InitialRunningXacts during decoding.
@ 2022-11-25 04:17  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 10+ messages in thread

From: Amit Kapila @ 2022-11-25 04:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix uninitialized access to InitialRunningXacts during decoding.

In commit 272248a0c, we introduced an InitialRunningXacts array to
remember transactions and subtransactions that were running when the
xl_running_xacts record that we decoded was written. This array was
allocated in the snapshot builder memory context after we restore
serialized snapshot but we forgot to reset the array while freeing the
builder memory context. So, the next time when we start decoding in the
same session where we don't restore any serialized snapshot, we ended up
using the uninitialized array and that can lead to unpredictable behavior.

This problem doesn't exist in HEAD as instead of using
InitialRunningXacts, we added the list of transaction IDs and
sub-transaction IDs, that have modified catalogs and are running during
snapshot serialization, to the serialized snapshot (see commit 7f13ac8123).

Reported-by: Maxim Orlov
Author: Masahiko Sawada
Reviewed-by: Amit Kapila, Maxim Orlov
Backpatch-through: 11
Discussion: https://postgr.es/m/CACG=ezZoz_KG+Ryh9MrU_g5e0HiVoHocEvqFF=NRrhrwKmEQJQ@mail.gmail.com

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/replication/logical/snapbuild.c | 7 +++++++
1 file changed, 7 insertions(+)



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

* pgsql: Fix uninitialized access to InitialRunningXacts during decoding.
@ 2022-11-25 04:17  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 10+ messages in thread

From: Amit Kapila @ 2022-11-25 04:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix uninitialized access to InitialRunningXacts during decoding.

In commit 272248a0c, we introduced an InitialRunningXacts array to
remember transactions and subtransactions that were running when the
xl_running_xacts record that we decoded was written. This array was
allocated in the snapshot builder memory context after we restore
serialized snapshot but we forgot to reset the array while freeing the
builder memory context. So, the next time when we start decoding in the
same session where we don't restore any serialized snapshot, we ended up
using the uninitialized array and that can lead to unpredictable behavior.

This problem doesn't exist in HEAD as instead of using
InitialRunningXacts, we added the list of transaction IDs and
sub-transaction IDs, that have modified catalogs and are running during
snapshot serialization, to the serialized snapshot (see commit 7f13ac8123).

Reported-by: Maxim Orlov
Author: Masahiko Sawada
Reviewed-by: Amit Kapila, Maxim Orlov
Backpatch-through: 11
Discussion: https://postgr.es/m/CACG=ezZoz_KG+Ryh9MrU_g5e0HiVoHocEvqFF=NRrhrwKmEQJQ@mail.gmail.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9f2cc1a73ccf84c24dc4c386721b3bb73757dc24

Modified Files
--------------
src/backend/replication/logical/snapbuild.c | 7 +++++++
1 file changed, 7 insertions(+)



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

* pgsql: Fix uninitialized access to InitialRunningXacts during decoding.
@ 2022-11-25 04:17  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 10+ messages in thread

From: Amit Kapila @ 2022-11-25 04:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix uninitialized access to InitialRunningXacts during decoding.

In commit 272248a0c, we introduced an InitialRunningXacts array to
remember transactions and subtransactions that were running when the
xl_running_xacts record that we decoded was written. This array was
allocated in the snapshot builder memory context after we restore
serialized snapshot but we forgot to reset the array while freeing the
builder memory context. So, the next time when we start decoding in the
same session where we don't restore any serialized snapshot, we ended up
using the uninitialized array and that can lead to unpredictable behavior.

This problem doesn't exist in HEAD as instead of using
InitialRunningXacts, we added the list of transaction IDs and
sub-transaction IDs, that have modified catalogs and are running during
snapshot serialization, to the serialized snapshot (see commit 7f13ac8123).

Reported-by: Maxim Orlov
Author: Masahiko Sawada
Reviewed-by: Amit Kapila, Maxim Orlov
Backpatch-through: 11
Discussion: https://postgr.es/m/CACG=ezZoz_KG+Ryh9MrU_g5e0HiVoHocEvqFF=NRrhrwKmEQJQ@mail.gmail.com

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9b788aafdc64531388e0f2c0f064e946b8aa6378

Modified Files
--------------
src/backend/replication/logical/snapbuild.c | 7 +++++++
1 file changed, 7 insertions(+)



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

* pgsql: Fix uninitialized access to InitialRunningXacts during decoding.
@ 2022-11-25 04:17  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 10+ messages in thread

From: Amit Kapila @ 2022-11-25 04:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix uninitialized access to InitialRunningXacts during decoding.

In commit 272248a0c, we introduced an InitialRunningXacts array to
remember transactions and subtransactions that were running when the
xl_running_xacts record that we decoded was written. This array was
allocated in the snapshot builder memory context after we restore
serialized snapshot but we forgot to reset the array while freeing the
builder memory context. So, the next time when we start decoding in the
same session where we don't restore any serialized snapshot, we ended up
using the uninitialized array and that can lead to unpredictable behavior.

This problem doesn't exist in HEAD as instead of using
InitialRunningXacts, we added the list of transaction IDs and
sub-transaction IDs, that have modified catalogs and are running during
snapshot serialization, to the serialized snapshot (see commit 7f13ac8123).

Reported-by: Maxim Orlov
Author: Masahiko Sawada
Reviewed-by: Amit Kapila, Maxim Orlov
Backpatch-through: 11
Discussion: https://postgr.es/m/CACG=ezZoz_KG+Ryh9MrU_g5e0HiVoHocEvqFF=NRrhrwKmEQJQ@mail.gmail.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/898ef41bf6f400264616444fbaea669e0685f98f

Modified Files
--------------
src/backend/replication/logical/snapbuild.c | 7 +++++++
1 file changed, 7 insertions(+)



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

* pgsql: Fix uninitialized access to InitialRunningXacts during decoding
@ 2023-09-12 04:56  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 10+ messages in thread

From: Amit Kapila @ 2023-09-12 04:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix uninitialized access to InitialRunningXacts during decoding after ERROR.

The transactions and subtransactions array that was allocated under
snapshot builder memory context and recorded during decoding was not
cleared in case of errors. This can result in an assertion failure if we
attempt to retry logical decoding within the same session. To address this
issue, we register a callback function under the snapshot builder memory
context to clear the recorded transactions and subtransactions array along
with the context.

This problem doesn't exist in PG16 and HEAD as instead of using
InitialRunningXacts, we added the list of transaction IDs and
sub-transaction IDs, that have modified catalogs and are running during
snapshot serialization, to the serialized snapshot (see commit 7f13ac8123).

Author: Hou Zhijie
Reviewed-by: Amit Kapila
Backpatch-through: 11
Discussion: http://postgr.es/m/18055-ab3beed9f4b7b7d6@postgresql.org

Branch
------
REL_15_STABLE

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

Modified Files
--------------
src/backend/replication/logical/snapbuild.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



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

* pgsql: Fix uninitialized access to InitialRunningXacts during decoding
@ 2023-09-12 04:56  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 10+ messages in thread

From: Amit Kapila @ 2023-09-12 04:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix uninitialized access to InitialRunningXacts during decoding after ERROR.

The transactions and subtransactions array that was allocated under
snapshot builder memory context and recorded during decoding was not
cleared in case of errors. This can result in an assertion failure if we
attempt to retry logical decoding within the same session. To address this
issue, we register a callback function under the snapshot builder memory
context to clear the recorded transactions and subtransactions array along
with the context.

This problem doesn't exist in PG16 and HEAD as instead of using
InitialRunningXacts, we added the list of transaction IDs and
sub-transaction IDs, that have modified catalogs and are running during
snapshot serialization, to the serialized snapshot (see commit 7f13ac8123).

Author: Hou Zhijie
Reviewed-by: Amit Kapila
Backpatch-through: 11
Discussion: http://postgr.es/m/18055-ab3beed9f4b7b7d6@postgresql.org

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/replication/logical/snapbuild.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



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

* pgsql: Fix uninitialized access to InitialRunningXacts during decoding
@ 2023-09-12 04:56  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 10+ messages in thread

From: Amit Kapila @ 2023-09-12 04:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix uninitialized access to InitialRunningXacts during decoding after ERROR.

The transactions and subtransactions array that was allocated under
snapshot builder memory context and recorded during decoding was not
cleared in case of errors. This can result in an assertion failure if we
attempt to retry logical decoding within the same session. To address this
issue, we register a callback function under the snapshot builder memory
context to clear the recorded transactions and subtransactions array along
with the context.

This problem doesn't exist in PG16 and HEAD as instead of using
InitialRunningXacts, we added the list of transaction IDs and
sub-transaction IDs, that have modified catalogs and are running during
snapshot serialization, to the serialized snapshot (see commit 7f13ac8123).

Author: Hou Zhijie
Reviewed-by: Amit Kapila
Backpatch-through: 11
Discussion: http://postgr.es/m/18055-ab3beed9f4b7b7d6@postgresql.org

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/backend/replication/logical/snapbuild.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



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

* pgsql: Fix uninitialized access to InitialRunningXacts during decoding
@ 2023-09-12 04:56  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 10+ messages in thread

From: Amit Kapila @ 2023-09-12 04:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix uninitialized access to InitialRunningXacts during decoding after ERROR.

The transactions and subtransactions array that was allocated under
snapshot builder memory context and recorded during decoding was not
cleared in case of errors. This can result in an assertion failure if we
attempt to retry logical decoding within the same session. To address this
issue, we register a callback function under the snapshot builder memory
context to clear the recorded transactions and subtransactions array along
with the context.

This problem doesn't exist in PG16 and HEAD as instead of using
InitialRunningXacts, we added the list of transaction IDs and
sub-transaction IDs, that have modified catalogs and are running during
snapshot serialization, to the serialized snapshot (see commit 7f13ac8123).

Author: Hou Zhijie
Reviewed-by: Amit Kapila
Backpatch-through: 11
Discussion: http://postgr.es/m/18055-ab3beed9f4b7b7d6@postgresql.org

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7e57208ed51a9f29e7e1a5d103452bc0e54f5a96

Modified Files
--------------
src/backend/replication/logical/snapbuild.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



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

* pgsql: Fix uninitialized access to InitialRunningXacts during decoding
@ 2023-09-12 04:56  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 10+ messages in thread

From: Amit Kapila @ 2023-09-12 04:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix uninitialized access to InitialRunningXacts during decoding after ERROR.

The transactions and subtransactions array that was allocated under
snapshot builder memory context and recorded during decoding was not
cleared in case of errors. This can result in an assertion failure if we
attempt to retry logical decoding within the same session. To address this
issue, we register a callback function under the snapshot builder memory
context to clear the recorded transactions and subtransactions array along
with the context.

This problem doesn't exist in PG16 and HEAD as instead of using
InitialRunningXacts, we added the list of transaction IDs and
sub-transaction IDs, that have modified catalogs and are running during
snapshot serialization, to the serialized snapshot (see commit 7f13ac8123).

Author: Hou Zhijie
Reviewed-by: Amit Kapila
Backpatch-through: 11
Discussion: http://postgr.es/m/18055-ab3beed9f4b7b7d6@postgresql.org

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/backend/replication/logical/snapbuild.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



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


end of thread, other threads:[~2023-09-12 04:56 UTC | newest]

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 04:17 pgsql: Fix uninitialized access to InitialRunningXacts during decoding. Amit Kapila <akapila@postgresql.org>
2022-11-25 04:17 pgsql: Fix uninitialized access to InitialRunningXacts during decoding. Amit Kapila <akapila@postgresql.org>
2022-11-25 04:17 pgsql: Fix uninitialized access to InitialRunningXacts during decoding. Amit Kapila <akapila@postgresql.org>
2022-11-25 04:17 pgsql: Fix uninitialized access to InitialRunningXacts during decoding. Amit Kapila <akapila@postgresql.org>
2022-11-25 04:17 pgsql: Fix uninitialized access to InitialRunningXacts during decoding. Amit Kapila <akapila@postgresql.org>
2023-09-12 04:56 pgsql: Fix uninitialized access to InitialRunningXacts during decoding Amit Kapila <akapila@postgresql.org>
2023-09-12 04:56 pgsql: Fix uninitialized access to InitialRunningXacts during decoding Amit Kapila <akapila@postgresql.org>
2023-09-12 04:56 pgsql: Fix uninitialized access to InitialRunningXacts during decoding Amit Kapila <akapila@postgresql.org>
2023-09-12 04:56 pgsql: Fix uninitialized access to InitialRunningXacts during decoding Amit Kapila <akapila@postgresql.org>
2023-09-12 04:56 pgsql: Fix uninitialized access to InitialRunningXacts during decoding Amit Kapila <akapila@postgresql.org>

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