shmem_startup_hook called twice on Windows
Sami Imseih <samimseih@gmail.com>
From: Sami Imseih <samimseih@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-08-15T14:17:22Z
Lists: pgsql-hackers
Hi, While working on a related area, I noticed that shmem_startup_hook is called twice under EXEC_BACKEND. The first call occurs in CreateSharedMemoryAndSemaphores() during postmaster startup (!IsUnderPostmaster), which is expected. The second call happens in AttachSharedMemoryStructs() (when EXEC_BACKEND is defined), and this occurs in normal backends (IsUnderPostmaster). The second call does not seem correct. The startup hook that should only run during postmaster initialization, AFAIK. Blame shows that this change was introduced in commit 69d903367c, but I could not determine the rationale from the discussion, so it may have been an oversight. Thoughts? -- Sami Imseih Amazon Web Services (AWS)
Commits
-
Fix documentation for shmem_startup_hook.
- d96c854dfc63 19 (unreleased) landed
- a80b7a0547da 18.0 landed
- 778f391c26c6 17.7 landed
-
test_slru: Fix LWLock tranche allocation in EXEC_BACKEND builds.
- 530cfa8eb50c 19 (unreleased) landed
-
doc: Reorganize section for shared memory and LWLocks.
- 964152c476f2 17.0 cited
-
Refactor CreateSharedMemoryAndSemaphores
- 69d903367cde 17.0 cited