Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd0410d6

Browse files
committed
Eliminate one background-worker-related flag variable.
Teach sigusr1_handler() to use the same test for whether a workermight need to be started as ServerLoop(). Aside from being perhapsa bit simpler, this prevents a potentially-unbounded delay whenstarting a background worker. On some platforms, select() doesn'treturn when interrupted by a signal, but is instead restarted,including a reset of the timeout to the originally-requested value.If signals arrive often enough, but no connection requests arrive,sigusr1_handler() will be executed repeatedly, but the body ofServerLoop() won't be reached. This change ensures that, even inthat case, background workers will eventually get launched.This is far from a perfect fix; really, we need select() to returncontrol to ServerLoop() after an interrupt, either via the self-pipetrick or some other mechanism. But that's going to require morework and discussion, so let's do this for now to at least mitigatethe damage.Per investigation of test_shm_mq failures on buildfarm member anole.
1 parent513d06d commitd0410d6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4752,15 +4752,14 @@ static void
47524752
sigusr1_handler(SIGNAL_ARGS)
47534753
{
47544754
intsave_errno=errno;
4755-
boolstart_bgworker= false;
47564755

47574756
PG_SETMASK(&BlockSig);
47584757

47594758
/* Process background worker state change. */
47604759
if (CheckPostmasterSignal(PMSIGNAL_BACKGROUND_WORKER_CHANGE))
47614760
{
47624761
BackgroundWorkerStateChange();
4763-
start_bgworker= true;
4762+
StartWorkerNeeded= true;
47644763
}
47654764

47664765
/*
@@ -4801,10 +4800,10 @@ sigusr1_handler(SIGNAL_ARGS)
48014800

48024801
pmState=PM_HOT_STANDBY;
48034802
/* Some workers may be scheduled to start now */
4804-
start_bgworker= true;
4803+
StartWorkerNeeded= true;
48054804
}
48064805

4807-
if (start_bgworker)
4806+
if (StartWorkerNeeded||HaveCrashedWorker)
48084807
maybe_start_bgworker();
48094808

48104809
if (CheckPostmasterSignal(PMSIGNAL_WAKEN_ARCHIVER)&&

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp