Fix pg_dump's sigTermHandler() to use _exit() not exit().

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 208e262f9246df9050aee63a933bb8b7fe265163
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2020-01-20T17:57:17Z
Releases: 9.6.17
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: https://postgr.es/m/16199-cb2f121146a96f9b@postgresql.org

Files

PathChange+/−
src/bin/pg_dump/parallel.c modified +5 −2

Discussion