From: | Greg Sabino Mullane <htamfids(at)gmail(dot)com> |
---|---|
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 14:54:34 |
Message-ID: | CAKAnmmJCdq5Z0iKKwPOeocX+GtAsFMR=iCUJYudHyCPP_kcUzQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Feb 26, 2025 at 12:31 AM Srinath Reddy <srinath2133(at)gmail(dot)com>
wrote:
> i was actually trying to recreate power outage scenario using
>>> node->kill9(),node->start() in a custom tap test,then i found this crash.
>>
>>
LOL ,that's not a power outage test, that's a kill -9 postgres test. A true
power outage would take care of any shared memory problems as well.
Carefully clear the shared memory as part of the test (you can find the key
in postmaster.pid), or do a proper test with something like:
echo b > /proc/sysrq-trigger
> i am guessing you mean "reference count to shared memory block" means
>> shmem_nattach right? i think this will be incremented by 1 when a process
>> attached to the shmem segment using shmat() in postgres case its the
>> postmaster who attaches during creation of shmem segment and detaches
>> during postmaster's on_shmem_exit is called during if it exits properly or
>> not dies suddenly (as the case with kill -9) ,during detaching only the
>> shmem_nattach will be decremented by 1 ,AFAIK the child processes will get
>> to use the shmem segment but never attaches or detaches so they are not
>> effecting the shmem_nattach.so as the shmem_nattach is not
>> 0 PGSharedMemoryAttach thinks the shmem state is still attached and in use.
>>
>
You might be overthinking this. A server crash is much more likely than a
random postgres crash. Test the former, by all means. The latter is
expected to have some potential manual cleanup, for safety reasons as
explained above.
--
Cheers,
Greg
--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Sabino Mullane | 2025-02-26 15:01:14 | Re: psql \dh: List High-Level (Root) Tables and Indexes |
Previous Message | Peter Eisentraut | 2025-02-26 14:30:49 | Re: Support a wildcard in backtrace_functions |