White duck standing in front of a damaged car with crumpled hood and open door, surrounded by yellow stars.

send_abort_for_crash and send_abort_for_kill are the only two parameters in PostgreSQL whose job is to make a crash worse, on purpose, so that it leaves evidence behind.

The machinery they modify is the one I walked through in restart_after_crash. When a child process is killed by a signal, or exits with any status other than 0 or 1, the postmaster sends SIGQUIT to every other child except the logger. A backend answers that with quickdie(), which writes a warning to its client and leaves through _exit(2); the auxiliary processes do the same minus the warning. Anything still alive five seconds later gets SIGKILL. Then shared memory is rebuilt and the startup process replays WAL. send_abort_for_crash = on replaces the SIGQUIT with SIGABRT; send_abort_for_kill = on replaces the SIGKILL with SIGABRT. Both default to off, both are sighup (so you can turn them on and off with a reload, which turns out to matter), both arrived in PostgreSQL 16, and both live in the Developer Options section of the manual, which, like everything else in that section, means they are left out of postgresql.conf.sample and you will not find them by grepping the file you already have.

The point of SIGABRT is that PostgreSQL does nothing with it. The server does raise it on itself, through abort(), on a PANIC or a failed assertion, so terminated by signal 6: Aborted in a log does not by itself mean these parameters were on; but no process installs a handler for it, and pqsignal.c goes out of its way to make sure the signal is never blocked. The kernel’s default action runs instead: write a core file and terminate. A crash normally gets you exactly one core, from the process that crashed, and quickdie() and SIGKILL between them destroy the state of everything else. If the process you actually need to look at is one of the others (the backend holding the lock everyone was queued behind, the checkpointer, the one that was wedged), the default throws it away.

Tom Lane added both in November 2022, after his NetBSD buildfarm animal mamba had been intermittently failing replication tests since the day it joined, in a way he could not reproduce anywhere else: a process was stuck, and by the time anyone could look, the postmaster’s SIGKILL had seen to it that there was nothing to look at. He proposed SIGABRT in place of SIGKILL. Andres Freund, who had tried the same thing as a #define while chasing a hang in the asynchronous I/O work, reported that it “did cause a problematic flood of core files” and suggested a GUC instead. The postmaster had long carried a -T switch that sent SIGSTOP to the surviving children so a developer could take their cores by hand; Tom’s view of that workflow was “mighty last-century,” and in the same commit -T became a synonym for send_abort_for_crash = on and the -n switch, which had done nothing for decades, was removed. Hold the thought about the flood.

Here is what the flood looks like. I set up an 18.6 cluster with shared_buffers = 128MB, one client idle in a transaction, one client sitting in pg_sleep(), and a third backend I sent SIGSEGV. At the defaults the cluster was taking connections again about half a second later, the sleeping client printed the familiar WARNING: terminating connection because of crash of another server process, and there was one core file in the data directory: 161 MB, belonging to the backend I had killed. With send_abort_for_crash = on and nothing else changed (the DEBUG lines are there because I was running with log_min_messages = debug3):

1LOG: client backend (PID 4420) was terminated by signal 11: Segmentation fault
2LOG: terminating any other active server processes
3DEBUG: sending signal 6/SIGABRT to client backend process with pid 4413
4DEBUG: sending signal 6/SIGABRT to client backend process with pid 4412
5DEBUG: sending signal 6/SIGABRT to background worker process with pid 4362
6DEBUG: sending signal 6/SIGABRT to autovacuum launcher process with pid 4361
7DEBUG: sending signal 6/SIGABRT to walwriter process with pid 4360
8DEBUG: sending signal 6/SIGABRT to background writer process with pid 4359
9DEBUG: sending signal 6/SIGABRT to checkpointer process with pid 4358
10DEBUG: sending signal 6/SIGABRT to io worker process with pid 4356
11DEBUG: sending signal 6/SIGABRT to io worker process with pid 4355
12DEBUG: sending signal 6/SIGABRT to io worker process with pid 4354

Eleven core files, 1.8 GB, and 4.3 seconds before the cluster took a connection again, because the postmaster waits for every child to exit before it logs all server processes terminated; reinitializing, and a child that is writing a core file has not exited yet. The sleeping client did not get the warning; quickdie() never ran, so all it saw was server closed the connection unexpectedly.

The size is not a coincidence. Linux’s default coredump_filter includes anonymous shared mappings, which is exactly what shared_buffers is (unless you use huge pages, which the default filter leaves out), so every one of those cores contains the entire shared memory segment. With shared_buffers = 1GB each core was 1.14 GB, the same otherwise-idle cluster produced 12.5 GB of them, and it was about fifteen seconds from the segfault to database system is ready to accept connections. Scale that to a server you would actually run: 32 GB of shared_buffers, no huge pages, and two hundred connections is more than six terabytes of core files per crash, written into the data directory, by a cluster that is in the middle of restarting because something is wrong with it. The manual warns that this can consume “lots of disk space.” It can.

That 1 GB run also exposed the trap in enabling only the first parameter. The crashed backend’s own core was finished before the postmaster even noticed the crash, but the other ten, all written at once, took longer than five seconds, and at the five-second mark the postmaster did what it always does: issuing SIGKILL to recalcitrant children. SIGKILL interrupts a core dump in progress. Ten of my eleven cores came out between 530 and 720 MB, and gdb greeted each one with has a segment extending past end of file. Only the crashed backend’s core was intact, and I already had that one at the defaults. With send_abort_for_kill = on as well, the five-second escalation sends a second SIGABRT, which a process that is already dumping core ignores, and all eleven cores arrived complete. If you turn on send_abort_for_crash, turn on send_abort_for_kill with it. On its own, on any cluster where the surviving children’s cores together take more than five seconds to write, which does not take much shared_buffers, the first parameter manufactures truncated cores.

send_abort_for_kill by itself is the more defensible of the two, because the process it targets is precisely the one the default destroys without a trace. I built a small C function that blocks SIGQUIT and then sleeps, called it from one backend, and segfaulted another. At the defaults the stuck backend was SIGKILLed about five seconds after the crash and left nothing. With send_abort_for_kill = on the log said issuing SIGABRT to recalcitrant children instead, and the resulting core had stuck_inner_loop sitting right where it should be, a few frames under standard_ExecutorRun. If a backend is ever stuck for a reason you cannot reproduce, that core is the only artifact you will get, and it costs one core file rather than one per process. The same escalation runs during pg_ctl stop -m immediate, so this parameter also governs what happens to a backend that will not die during an immediate shutdown. (send_abort_for_crash does not: an immediate shutdown sends SIGQUIT regardless, by design.)

The catch is that SIGABRT is not SIGKILL. SIGKILL cannot be blocked, caught, or ignored, and it ends a stopped process. SIGABRT can be all of those things, and to a stopped process it is merely pending. The postmaster escalates once; after it has sent its SIGABRT it resets the timer, and with this parameter on there is no path left by which it will ever send SIGKILL. So with send_abort_for_kill = on, a backend somebody has attached gdb to, or hit with SIGSTOP, keeps the whole cluster in the database system is in recovery mode for as long as it stays that way. I stopped a backend with SIGSTOP, crashed another, and thirty seconds later the stopped one was still there, SIGABRT pending, the cluster refusing connections; it dumped core the moment I sent SIGCONT, and the cluster was back within a second. With gdb attached to the backend instead, the same thing: the cluster stayed down until I told gdb to continue. At the defaults the same experiment was over in about six seconds. On 19, as of RC1 and the stable branch on 6 November, the escalation after a crash does not fire for up to sixty seconds on an idle cluster, for the reason covered in the restart_after_crash post, and that delay applies to SIGABRT exactly as it does to SIGKILL.

Two pieces of plumbing decide whether either parameter does anything at all. The first is the core size limit the postmaster inherited from whatever started it: with ulimit -c 0 the postmaster sent its ten SIGABRTs, no core appeared anywhere, and the only observable effect of the parameter was that clients lost their warning message. Check Max core file size in /proc/<postmaster pid>/limits before you rely on it. The second is kernel.core_pattern. The kernel’s own default is the bare word core, with no PID, and the kernel unlinks any existing file of that name and recreates it exclusively, so eleven processes dumping into $PGDATA/core within a second of each other produce one survivor. When I set that default, mine was io worker 2. If core_pattern is a pipe into systemd-coredump, the files go to /var/lib/systemd/coredump compressed, under a storage cap that defaults to ten percent of the filesystem and no more than 4 GiB, and coredumpctl is how you find them. Neither arrangement is what you want when you have deliberately asked for a dozen gigabyte-sized files; set a pattern with %p and %e in it somewhere with room, and do it before the crash, not after.

Leave both off in production. If you are chasing a crash or a hang you cannot reproduce, on a replica of the problem that nobody is relying on, turn both on together with a reload, check the limit and the pattern, wait for the event, and turn them back off while you copy the cores somewhere else. For one stuck process on a system that has to stay up, you do not need either parameter: gcore -o /somewhere/pg <pid> pauses the backend only for as long as it takes to write a complete core and then lets it carry on, and pg_ctl kill ABRT <pid> takes one and starts the crash-restart cycle, which at least you will have chosen. [PLACEHOLDER: credential aside; confirm, replace, or cut. e.g. “In seventeen years of PGX crash forensics I have wanted the core of the process holding the lock far more often than the core of the process that died, and I have had it exactly never.”] The parameter that gets you that core is send_abort_for_kill, and the price of it is that the only signal in Unix that always works is no longer in the postmaster’s hands.