Skip to content

Commit bedadc7

Browse files
committed
Make archiver's SIGQUIT handler exit via _exit().
Commit 8e19a82 changed the SIGQUIT handlers of almost all server processes not to run atexit callbacks. The archiver process was skipped, perhaps because it's not connected to shared memory; but it's just as true here that running atexit callbacks in a signal handler is unsafe. So let's make it work like the rest. In HEAD and v13, we can use the common SignalHandlerForCrashExit handler. Before that, just tweak pgarch_exit to use _exit(2) explicitly. Like the previous commit, back-patch to all supported branches. Kyotaro Horiguchi, back-patching by me Discussion: https://postgr.es/m/1850884.1599601164@sss.pgh.pa.us
1 parent 0aa8f76 commit bedadc7

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/backend/postmaster/pgarch.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ static pid_t pgarch_forkexec(void);
9696
#endif
9797

9898
NON_EXEC_STATIC void PgArchiverMain(int argc, char *argv[]) pg_attribute_noreturn();
99-
static void pgarch_exit(SIGNAL_ARGS);
10099
static void pgarch_waken(SIGNAL_ARGS);
101100
static void pgarch_waken_stop(SIGNAL_ARGS);
102101
static void pgarch_MainLoop(void);
@@ -229,7 +228,7 @@ PgArchiverMain(int argc, char *argv[])
229228
pqsignal(SIGHUP, SignalHandlerForConfigReload);
230229
pqsignal(SIGINT, SIG_IGN);
231230
pqsignal(SIGTERM, SignalHandlerForShutdownRequest);
232-
pqsignal(SIGQUIT, pgarch_exit);
231+
pqsignal(SIGQUIT, SignalHandlerForCrashExit);
233232
pqsignal(SIGALRM, SIG_IGN);
234233
pqsignal(SIGPIPE, SIG_IGN);
235234
pqsignal(SIGUSR1, pgarch_waken);
@@ -246,14 +245,6 @@ PgArchiverMain(int argc, char *argv[])
246245
exit(0);
247246
}
248247

249-
/* SIGQUIT signal handler for archiver process */
250-
static void
251-
pgarch_exit(SIGNAL_ARGS)
252-
{
253-
/* SIGQUIT means curl up and die ... */
254-
exit(1);
255-
}
256-
257248
/* SIGUSR1 signal handler for archiver process */
258249
static void
259250
pgarch_waken(SIGNAL_ARGS)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy