From: | Srinath Reddy <srinath2133(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Postmaster crashed during start |
Date: | 2025-02-26 03:22:13 |
Message-ID: | CAFC+b6rQ-EiB8Cks9GAUY_eNfoMoNLWFw5tbdcmHc3Pw9TkKrQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
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
HINT: Terminate any old server processes associated with data directory
*We can reproduce this*
> kill -9 $(head -n 1 $PGDATA/postmaster.pid) & ./pg_ctl -D $PGDATA -l
> $PGDATA/logfile start
*Reason of crash:*
when we kill postmaster with -9 signal the clean up does not happen where
the shared memory segment won't be detached but kernel will does this when
a process dies means the process which attached to segment will be detached
so shm_nattch will be 0 but in case before kernel comes up to detach the
process if we try to start postmaster again, during creation postmaster.pid
using CreateDataDirLockFile() postmaster checks for whether previous shmem
segment is still in use ,for this we are depending on shmStat.shm_nattch ==
0 ? SHMSTATE_UNATTACHED : SHMSTATE_ATTACHED; as if kernel didn't come up so
shm_attach is still 1 so the new postmaster will think the shmem segment is
in use and crashes.
should we even consider this as a bug or we should leave it as it depends
of how busy the kernel is and it didn't got time to do the clean up of the
dead postmaster process so didn't detached and decrement the shmem_nattach.
thoughts?
Thanks and Regards
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com <http://www.enterprisedb.com/>
From | Date | Subject | |
---|---|---|---|
Next Message | jian he | 2025-02-26 03:32:48 | Re: bug in stored generated column over domain with constraints. |
Previous Message | Corey Huinker | 2025-02-26 02:29:56 | Re: Statistics Import and Export |