Commit f62ab623 authored by Alvaro Herrera's avatar Alvaro Herrera

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)
parent 61a7d576
......@@ -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);
}
......
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