> > "Because this hook is executed by the postmaster and invoked by backends via
> > EXEC_BACKEND, it is essential to ensure that any code intended to run only
> > during postmaster startup is properly protected against repeated execution.
> > This can be enforced by verifying !IsUnderPostmaster be
On Fri, Aug 15, 2025 at 11:25:55AM -0500, Sami Imseih wrote:
> I noticed a few things where this behavior becomes very suspicious.
>
> For example, in pgss_startup_hook, every time startup_hook is run
> we take an exclusive LW lock. so, all backends now may be competing
> for that lock by nature o
> On Fri, Aug 15, 2025 at 10:36:47AM -0500, Sami Imseih wrote:
> > But that could potentially be dangerous if code in the startup hook gets
> > re-executed? I guess the doc below is giving a vague warning that one
> > should be careful what they put in that hook.
>
> The docs seem reasonably clear
On Fri, Aug 15, 2025 at 10:36:47AM -0500, Sami Imseih wrote:
> But that could potentially be dangerous if code in the startup hook gets
> re-executed? I guess the doc below is giving a vague warning that one
> should be careful what they put in that hook.
The docs seem reasonably clear that these
Sorry my last reply got mangled for some reason. Here it is again.
> > 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.
>
> I think the startup hook must run in each backend for
> 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() (
On Fri, Aug 15, 2025 at 09:17:22AM -0500, Sami Imseih wrote:
> 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
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
EX