From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't run atexit callbacks in quickdie signal handlers.
Date: Wed, 08 Aug 2018 16:19:38 +0000
Message-ID: <E1fnRBS-0005c6-HM@gemulon.postgresql.org> (raw)
Don't run atexit callbacks in quickdie signal handlers.
exit() is not async-signal safe. Even if the libc implementation is, 3rd
party libraries might have installed unsafe atexit() callbacks. After
receiving SIGQUIT, we really just want to exit as quickly as possible, so
we don't really want to run the atexit() callbacks anyway.
The original report by Jimmy Yih was a self-deadlock in startup_die().
However, this patch doesn't address that scenario; the signal handling
while waiting for the startup packet is more complicated. But at least this
alleviates similar problems in the SIGQUIT handlers, like that reported
by Asim R P later in the same thread.
Backpatch to 9.3 (all supported versions).
Discussion: https://www.postgresql.org/message-id/CAOMx_OAuRUHiAuCg2YgicZLzPVv5d9_H4KrL_OFsFP%3DVPekigA%40mail.g...
Branch
------
REL9_6_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/8e4e783ee4f1cb64a46798989e5fd04c7c0a2f53
Modified Files
--------------
src/backend/postmaster/bgworker.c | 25 +++++++++----------------
src/backend/postmaster/bgwriter.c | 24 +++++++++---------------
src/backend/postmaster/checkpointer.c | 24 +++++++++---------------
src/backend/postmaster/startup.c | 24 +++++++++---------------
src/backend/postmaster/walwriter.c | 24 +++++++++---------------
src/backend/replication/walreceiver.c | 32 +++++++++++++-------------------
src/backend/tcop/postgres.c | 32 +++++++++++++++++++-------------
7 files changed, 77 insertions(+), 108 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: heikki.linnakangas@iki.fi
Subject: Re: pgsql: Don't run atexit callbacks in quickdie signal handlers.
In-Reply-To: <E1fnRBS-0005c6-HM@gemulon.postgresql.org>
References: <E1fnRBS-0005c6-HM@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox