Fix pg_dump's sigTermHandler() to use _exit() not exit().
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 20 Jan 2020 17:57:18 +0000 (12:57 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 20 Jan 2020 17:57:18 +0000 (12:57 -0500)
commit42e538fe673b20d9adfc46bc889f3eb16ceb6538
tree0546d19ef3d63d0b1b8cf5e904d0aa3513166381
parenteb9d1f0504a64aeae2b91279bc59e2649d35b4b0
Fix pg_dump's sigTermHandler() to use _exit() not exit().

sigTermHandler() tried to be careful to invoke only operations that
are safe to do in a signal handler.  But for some reason we forgot
that exit(3) is not among those, because it calls atexit handlers
that might do various random things.  (pg_dump itself installs no
atexit handlers, but e.g. OpenSSL does.)  That led to crashes or
lockups when attempting to terminate a parallel dump or restore
via a signal.

Fix by calling _exit() instead.

Per bug #16199 from Raúl Marín.  Back-patch to all supported branches.

Discussion: http://postgr.es/m/16199-cb2f121146a96f9b@postgresql.org
src/bin/pg_dump/parallel.c