pgsql: Don't run atexit callbacks during signal exits from ProcessStart

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Don't run atexit callbacks during signal exits from ProcessStart
Дата
Msg-id E1kGlr3-0003y6-Rx@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Don't run atexit callbacks during signal exits from ProcessStartupPacket.

Although 58c6feccf fixed the case for SIGQUIT, we were still calling
proc_exit() from signal handlers for SIGTERM and timeout failures in
ProcessStartupPacket.  Fortunately, at the point where that code runs,
we haven't yet connected to shared memory in any meaningful way, so
there is nothing we need to undo in shared memory.  This means it
should be safe to use _exit(1) here, ie, not run any atexit handlers
but also inform the postmaster that it's not a crash exit.

To make sure nobody breaks the "nothing to undo" expectation, add
a cross-check that no on-shmem-exit or before-shmem-exit handlers
have been registered yet when we finish using these signal handlers.

This change is simple enough that maybe it could be back-patched,
but I won't risk that right now.

Discussion: https://postgr.es/m/1850884.1599601164@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6693a96b329ec46f1df916f2a28d640cc9a9977d

Modified Files
--------------
src/backend/postmaster/postmaster.c | 72 +++++++++++++++++--------------------
src/backend/storage/ipc/ipc.c       | 17 +++++++++
src/include/storage/ipc.h           |  1 +
3 files changed, 51 insertions(+), 39 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: pgsql: Update copyright year
Следующее
От: Alvaro Herrera
Дата:
Сообщение: pgsql: psql: Display stats target of extended statistics