From: Alvaro Herrera Date: Wed, 10 Apr 2013 19:01:16 +0000 (-0300) Subject: Fix SIGUSR1 handling by unconnected bgworkers X-Git-Tag: REL9_3_BETA1~111 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f62ab623adc63023c6aee22e2a6fe190439ca0c3;p=postgresql Fix SIGUSR1 handling by unconnected bgworkers Latch activity was not being detected by non-database-connected workers; the SIGUSR1 signal handler which is normally in charge of that was set to SIG_IGN. Create a simple handler to call latch_sigusr1_handler instead. Robert Haas (bug report and suggested fix) --- diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 5ff3577478..474e17e921 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -5354,6 +5354,22 @@ bgworker_die(SIGNAL_ARGS) MyBgworkerEntry->bgw_name))); } +/* + * Standard SIGUSR1 handler for unconnected workers + * + * Here, we want to make sure an unconnected worker will at least heed + * latch activity. + */ +static void +bgworker_sigusr1_handler(SIGNAL_ARGS) +{ + int save_errno = errno; + + latch_sigusr1_handler(); + + errno = save_errno; +} + static void do_start_bgworker(void) { @@ -5410,7 +5426,7 @@ do_start_bgworker(void) else { pqsignal(SIGINT, SIG_IGN); - pqsignal(SIGUSR1, SIG_IGN); + pqsignal(SIGUSR1, bgworker_sigusr1_handler); pqsignal(SIGFPE, SIG_IGN); }