Commit cd23a201 authored by Tom Lane's avatar Tom Lane

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
parent 4c870109
......@@ -606,8 +606,11 @@ sigTermHandler(SIGNAL_ARGS)
write_stderr("terminated by user\n");
}
/* And die. */
exit(1);
/*
* And die, using _exit() not exit() because the latter will invoke atexit
* handlers that can fail if we interrupted related code.
*/
_exit(1);
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment