v1-0001-Assert-ProcSignal-is-initialized-before-its-depen.patch
application/octet-stream
Filename: v1-0001-Assert-ProcSignal-is-initialized-before-its-depen.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v1-0001
Subject: Assert ProcSignal is initialized before its dependents
| File | + | − |
|---|---|---|
| src/backend/access/transam/xlog.c | 1 | 0 |
| src/backend/replication/logical/logicalctl.c | 1 | 0 |
| src/backend/storage/ipc/procsignal.c | 8 | 0 |
| src/include/storage/procsignal.h | 5 | 0 |
From 8a1dc18bbcf11a2eb36cfd3dbb290976d87284d1 Mon Sep 17 00:00:00 2001
From: Matthias van de Meent <boekewurm+postgres@gmail.com>
Date: Wed, 29 Apr 2026 12:10:44 +0200
Subject: [PATCH v1] Assert ProcSignal is initialized before its dependents
---
src/backend/access/transam/xlog.c | 1 +
src/backend/replication/logical/logicalctl.c | 1 +
src/backend/storage/ipc/procsignal.c | 8 ++++++++
src/include/storage/procsignal.h | 5 +++++
4 files changed, 15 insertions(+)
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index e39af79c03b..63e84b00cec 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4960,6 +4960,7 @@ SetDataChecksumsOff(void)
void
InitLocalDataChecksumState(void)
{
+ Assert(ProcSignalIsInitialized());
SpinLockAcquire(&XLogCtl->info_lck);
SetLocalDataChecksumState(XLogCtl->data_checksum_version);
SpinLockRelease(&XLogCtl->info_lck);
diff --git a/src/backend/replication/logical/logicalctl.c b/src/backend/replication/logical/logicalctl.c
index 72f68ec58ef..80308b619a4 100644
--- a/src/backend/replication/logical/logicalctl.c
+++ b/src/backend/replication/logical/logicalctl.c
@@ -173,6 +173,7 @@ update_xlog_logical_info(void)
void
InitializeProcessXLogLogicalInfo(void)
{
+ Assert(ProcSignalIsInitialized());
update_xlog_logical_info();
}
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index b0681ca0ae2..71a0b25e49e 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -232,6 +232,14 @@ ProcSignalInit(const uint8 *cancel_key, int cancel_key_len)
on_shmem_exit(CleanupProcSignalState, (Datum) 0);
}
+#ifdef USE_ASSERT_CHECKING
+bool
+ProcSignalIsInitialized(void)
+{
+ return MyProcSignalSlot != NULL;
+}
+#endif
+
/*
* CleanupProcSignalState
* Remove current process from ProcSignal mechanism
diff --git a/src/include/storage/procsignal.h b/src/include/storage/procsignal.h
index aaa158bfd66..1d2290c6975 100644
--- a/src/include/storage/procsignal.h
+++ b/src/include/storage/procsignal.h
@@ -87,4 +87,9 @@ typedef struct ProcSignalHeader ProcSignalHeader;
extern PGDLLIMPORT ProcSignalHeader *ProcSignal;
#endif
+#ifdef USE_ASSERT_CHECKING
+extern bool ProcSignalIsInitialized(void);
+#endif
+
+
#endif /* PROCSIGNAL_H */
--
2.50.1 (Apple Git-155)