pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix crash with wal_debug in EXEC_BACKEND child processes 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix crash with wal_debug in EXEC_BACKEND child processes @ 2026-10-09 22:21 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 2+ messages in thread From: Heikki Linnakangas @ 2026-10-09 22:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix crash with wal_debug in EXEC_BACKEND child processes Converting xlog.c to the new shared memory allocation API left the creation of the memory context used by wal_debug in the XLOGShmemInit() callback, which now only runs in the postmaster or in a standalone backend. Previously, XLOGShmemInit() ran in every child. As a result, walDebugCtx was left uninitialized in child processes in EXEC_BACKEND mode, and with wal_debug turned on, the backend crashed on first WAL insertion. Fix by moving the walDebugCtx initialization to a separate function that is called in each backend that wishes to create WAL records. (It cannot be created lazily on first WAL insertion, because it's done in a critical section, and you cannot create a new memory context in a critical section.) Oversight in 9b5acad3f40f. Co-authored-by:: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> Discussion: https://www.postgresql.org/message-id/CALj2ACUNL4Xn3aBzvm4DTpdr_L0-AfL2agsghMRRy_ZTiKhxSA@mail.gmail... Backpatch-through: 19 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/6873a138f782cf816e6019bbe922857050df96c9 Modified Files -------------- src/backend/access/transam/xlog.c | 40 ++++++++++++++++++++------------- src/backend/access/transam/xloginsert.c | 5 +++++ src/include/access/xlog.h | 3 +++ 3 files changed, 32 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix crash with wal_debug in EXEC_BACKEND child processes @ 2026-10-09 22:21 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 2+ messages in thread From: Heikki Linnakangas @ 2026-10-09 22:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix crash with wal_debug in EXEC_BACKEND child processes Converting xlog.c to the new shared memory allocation API left the creation of the memory context used by wal_debug in the XLOGShmemInit() callback, which now only runs in the postmaster or in a standalone backend. Previously, XLOGShmemInit() ran in every child. As a result, walDebugCtx was left uninitialized in child processes in EXEC_BACKEND mode, and with wal_debug turned on, the backend crashed on first WAL insertion. Fix by moving the walDebugCtx initialization to a separate function that is called in each backend that wishes to create WAL records. (It cannot be created lazily on first WAL insertion, because it's done in a critical section, and you cannot create a new memory context in a critical section.) Oversight in 9b5acad3f40f. Co-authored-by:: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> Discussion: https://www.postgresql.org/message-id/CALj2ACUNL4Xn3aBzvm4DTpdr_L0-AfL2agsghMRRy_ZTiKhxSA@mail.gmail... Backpatch-through: 19 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/270caee04f5632ab006ec8b3d160dabac91cdf31 Modified Files -------------- src/backend/access/transam/xlog.c | 40 ++++++++++++++++++++------------- src/backend/access/transam/xloginsert.c | 5 +++++ src/include/access/xlog.h | 3 +++ 3 files changed, 32 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-10-09 22:21 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-10-09 22:21 pgsql: Fix crash with wal_debug in EXEC_BACKEND child processes Heikki Linnakangas <heikki.linnakangas@iki.fi> 2026-10-09 22:21 pgsql: Fix crash with wal_debug in EXEC_BACKEND child processes Heikki Linnakangas <heikki.linnakangas@iki.fi>
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