Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f62ab62

Browse files
committed
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)
1 parent 61a7d57 commit f62ab62

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/backend/postmaster/postmaster.c

+17-1
Original file line numberDiff line numberDiff line change
@@ -5354,6 +5354,22 @@ bgworker_die(SIGNAL_ARGS)
53545354
MyBgworkerEntry->bgw_name)));
53555355
}
53565356

5357+
/*
5358+
* Standard SIGUSR1 handler for unconnected workers
5359+
*
5360+
* Here, we want to make sure an unconnected worker will at least heed
5361+
* latch activity.
5362+
*/
5363+
static void
5364+
bgworker_sigusr1_handler(SIGNAL_ARGS)
5365+
{
5366+
int save_errno = errno;
5367+
5368+
latch_sigusr1_handler();
5369+
5370+
errno = save_errno;
5371+
}
5372+
53575373
static void
53585374
do_start_bgworker(void)
53595375
{
@@ -5410,7 +5426,7 @@ do_start_bgworker(void)
54105426
else
54115427
{
54125428
pqsignal(SIGINT, SIG_IGN);
5413-
pqsignal(SIGUSR1, SIG_IGN);
5429+
pqsignal(SIGUSR1, bgworker_sigusr1_handler);
54145430
pqsignal(SIGFPE, SIG_IGN);
54155431
}
54165432

0 commit comments

Comments
 (0)