| From: | Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Don't run atexit callbacks in quickdie signal handlers. |
| Date: | 2018-08-08 16:19:38 |
| Message-ID: | E1fnRBS-0005cB-HW@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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.gmail.com
Branch
------
REL9_3_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/58ce9c7850b11a9a18eb7e5957a985c5f5486ef7
Modified Files
--------------
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 +++++++++++++++++++-------------
6 files changed, 68 insertions(+), 92 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2018-08-08 18:32:34 | pgsql: Remove unwanted "garbage cleanup" logic in Makefiles. |
| Previous Message | Tom Lane | 2018-08-08 15:44:56 | pgsql: Match RelOptInfos by relids not pointer equality. |