Re: Postmaster crashed during start

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Srinath Reddy <srinath2133(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Postmaster crashed during start
Date: 2025-02-26 03:53:01
Message-ID: 1699599.1740541981@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Srinath Reddy <srinath2133(at)gmail(dot)com> writes:
> when we kill postmaster using kill -9 and start immediately it crashes with
>> FATAL: pre-existing shared memory block (key 2495405, ID 360501) is still
>> in use

"Doctor, it hurts when I do this!"

"So don't do that!"

This is not a supported way of shutting down the postmaster, and it
never will be. Use SIGINT, or SIGQUIT if you are in a desperate
hurry and are willing to have the next startup take longer.

I think the specific reason you are seeing this is that it takes
nonzero time for the postmaster's orphaned child processes to
notice that the postmaster is gone and terminate. As long as
any of those children remain, the shared memory block will have
a nonzero reference count. The new postmaster sees that and
refuses to start, for the very sound reason that it risks
data corruption if it brings up a new set of worker processes
while any of the old ones are still running.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2025-02-26 03:55:19 Re: Statistics Import and Export
Previous Message Shlok Kyal 2025-02-26 03:51:29 Re: long-standing data loss bug in initial sync of logical replication