agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Fix memory leak in pgoutput with streamed prepared transactions. 6+ messages / 1 participants [nested] [flat]
* pgsql: Fix memory leak in pgoutput with streamed prepared transactions. @ 2026-09-18 17:19 Masahiko Sawada <msawada@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Masahiko Sawada @ 2026-09-18 17:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix memory leak in pgoutput with streamed prepared transactions. pgoutput records the toplevel XID in the relation's streamed_txns list, allocated in CacheMemoryContext, when it sends a relation's schema during a streamed transaction. We clean up that list at stream commit and stream abort, but missed stream prepare, so the XIDs stay around until a relcache invalidation for the relation or until the walsender exits. Fix by cleaning up the cache after writing the stream prepare message, marking the schema as sent as we do at stream commit. The subscriber applies the spooled relation messages at PREPARE time and its relation map isn't rolled back by ROLLBACK PREPARED, so we don't need to send the schema again even if the prepared transaction eventually aborts. Oversight in commit 63cf61cdeb7b. Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/CAJTYsWWt5aaKHCnV=jNOwABzspd-WbnhWLndDqtESDQRQ-BkKQ@mail.gmail.com Backpatch-through: 15 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/bb1e3e47562aa937d4cf81b1aef7a55d0a9c28dd Modified Files -------------- src/backend/replication/pgoutput/pgoutput.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix memory leak in pgoutput with streamed prepared transactions. @ 2026-09-18 17:19 Masahiko Sawada <msawada@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Masahiko Sawada @ 2026-09-18 17:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix memory leak in pgoutput with streamed prepared transactions. pgoutput records the toplevel XID in the relation's streamed_txns list, allocated in CacheMemoryContext, when it sends a relation's schema during a streamed transaction. We clean up that list at stream commit and stream abort, but missed stream prepare, so the XIDs stay around until a relcache invalidation for the relation or until the walsender exits. Fix by cleaning up the cache after writing the stream prepare message, marking the schema as sent as we do at stream commit. The subscriber applies the spooled relation messages at PREPARE time and its relation map isn't rolled back by ROLLBACK PREPARED, so we don't need to send the schema again even if the prepared transaction eventually aborts. Oversight in commit 63cf61cdeb7b. Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/CAJTYsWWt5aaKHCnV=jNOwABzspd-WbnhWLndDqtESDQRQ-BkKQ@mail.gmail.com Backpatch-through: 15 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e995b2cb456cbf904bc8bdb213fa97b3e31a11a5 Modified Files -------------- src/backend/replication/pgoutput/pgoutput.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix memory leak in pgoutput with streamed prepared transactions. @ 2026-09-18 17:19 Masahiko Sawada <msawada@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Masahiko Sawada @ 2026-09-18 17:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix memory leak in pgoutput with streamed prepared transactions. pgoutput records the toplevel XID in the relation's streamed_txns list, allocated in CacheMemoryContext, when it sends a relation's schema during a streamed transaction. We clean up that list at stream commit and stream abort, but missed stream prepare, so the XIDs stay around until a relcache invalidation for the relation or until the walsender exits. Fix by cleaning up the cache after writing the stream prepare message, marking the schema as sent as we do at stream commit. The subscriber applies the spooled relation messages at PREPARE time and its relation map isn't rolled back by ROLLBACK PREPARED, so we don't need to send the schema again even if the prepared transaction eventually aborts. Oversight in commit 63cf61cdeb7b. Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/CAJTYsWWt5aaKHCnV=jNOwABzspd-WbnhWLndDqtESDQRQ-BkKQ@mail.gmail.com Backpatch-through: 15 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a477847ebe2a1f700ce1844a8b718fdd66e9b7d0 Modified Files -------------- src/backend/replication/pgoutput/pgoutput.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix memory leak in pgoutput with streamed prepared transactions. @ 2026-09-18 17:19 Masahiko Sawada <msawada@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Masahiko Sawada @ 2026-09-18 17:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix memory leak in pgoutput with streamed prepared transactions. pgoutput records the toplevel XID in the relation's streamed_txns list, allocated in CacheMemoryContext, when it sends a relation's schema during a streamed transaction. We clean up that list at stream commit and stream abort, but missed stream prepare, so the XIDs stay around until a relcache invalidation for the relation or until the walsender exits. Fix by cleaning up the cache after writing the stream prepare message, marking the schema as sent as we do at stream commit. The subscriber applies the spooled relation messages at PREPARE time and its relation map isn't rolled back by ROLLBACK PREPARED, so we don't need to send the schema again even if the prepared transaction eventually aborts. Oversight in commit 63cf61cdeb7b. Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/CAJTYsWWt5aaKHCnV=jNOwABzspd-WbnhWLndDqtESDQRQ-BkKQ@mail.gmail.com Backpatch-through: 15 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3d6a4a582efe5c64abf1a3669d707f3f248bd3ef Modified Files -------------- src/backend/replication/pgoutput/pgoutput.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix memory leak in pgoutput with streamed prepared transactions. @ 2026-09-18 17:19 Masahiko Sawada <msawada@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Masahiko Sawada @ 2026-09-18 17:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix memory leak in pgoutput with streamed prepared transactions. pgoutput records the toplevel XID in the relation's streamed_txns list, allocated in CacheMemoryContext, when it sends a relation's schema during a streamed transaction. We clean up that list at stream commit and stream abort, but missed stream prepare, so the XIDs stay around until a relcache invalidation for the relation or until the walsender exits. Fix by cleaning up the cache after writing the stream prepare message, marking the schema as sent as we do at stream commit. The subscriber applies the spooled relation messages at PREPARE time and its relation map isn't rolled back by ROLLBACK PREPARED, so we don't need to send the schema again even if the prepared transaction eventually aborts. Oversight in commit 63cf61cdeb7b. Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/CAJTYsWWt5aaKHCnV=jNOwABzspd-WbnhWLndDqtESDQRQ-BkKQ@mail.gmail.com Backpatch-through: 15 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/feb975917c6f7b6875ba7a186a80ebfe58c29c45 Modified Files -------------- src/backend/replication/pgoutput/pgoutput.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix memory leak in pgoutput with streamed prepared transactions. @ 2026-09-18 17:19 Masahiko Sawada <msawada@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Masahiko Sawada @ 2026-09-18 17:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix memory leak in pgoutput with streamed prepared transactions. pgoutput records the toplevel XID in the relation's streamed_txns list, allocated in CacheMemoryContext, when it sends a relation's schema during a streamed transaction. We clean up that list at stream commit and stream abort, but missed stream prepare, so the XIDs stay around until a relcache invalidation for the relation or until the walsender exits. Fix by cleaning up the cache after writing the stream prepare message, marking the schema as sent as we do at stream commit. The subscriber applies the spooled relation messages at PREPARE time and its relation map isn't rolled back by ROLLBACK PREPARED, so we don't need to send the schema again even if the prepared transaction eventually aborts. Oversight in commit 63cf61cdeb7b. Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/CAJTYsWWt5aaKHCnV=jNOwABzspd-WbnhWLndDqtESDQRQ-BkKQ@mail.gmail.com Backpatch-through: 15 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/274da088e021a92e2ffd2b8938a7b978b2cf11b3 Modified Files -------------- src/backend/replication/pgoutput/pgoutput.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2026-09-18 17:19 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-09-18 17:19 pgsql: Fix memory leak in pgoutput with streamed prepared transactions. Masahiko Sawada <msawada@postgresql.org> 2026-09-18 17:19 pgsql: Fix memory leak in pgoutput with streamed prepared transactions. Masahiko Sawada <msawada@postgresql.org> 2026-09-18 17:19 pgsql: Fix memory leak in pgoutput with streamed prepared transactions. Masahiko Sawada <msawada@postgresql.org> 2026-09-18 17:19 pgsql: Fix memory leak in pgoutput with streamed prepared transactions. Masahiko Sawada <msawada@postgresql.org> 2026-09-18 17:19 pgsql: Fix memory leak in pgoutput with streamed prepared transactions. Masahiko Sawada <msawada@postgresql.org> 2026-09-18 17:19 pgsql: Fix memory leak in pgoutput with streamed prepared transactions. Masahiko Sawada <msawada@postgresql.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox