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/>