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.