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

Commit 8d498a5

Browse files
committed
Fix bogus coding in WaitForBackgroundWorkerShutdown().
Some conditions resulted in "return" directly out of a PG_TRY block, which left the exception stack dangling, and to add insult to injury failed to restore the state of set_latch_on_sigusr1. This is a bug only in 9.5; in HEAD it was accidentally fixed by commit db0f6ca, which removed the surrounding PG_TRY block. However, I (tgl) chose to apply the patch to HEAD as well, because the old coding was gratuitously different from WaitForBackgroundWorkerStartup(), and there would indeed have been no bug if it were done like that to start with. Dmitry Ivanov Discussion: <1637882.WfYN5gPf1A@abook>
1 parent 81568a9 commit 8d498a5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/postmaster/bgworker.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,13 +1005,16 @@ WaitForBackgroundWorkerShutdown(BackgroundWorkerHandle *handle)
10051005

10061006
status = GetBackgroundWorkerPid(handle, &pid);
10071007
if (status == BGWH_STOPPED)
1008-
return status;
1008+
break;
10091009

10101010
rc = WaitLatch(&MyProc->procLatch,
10111011
WL_LATCH_SET | WL_POSTMASTER_DEATH, 0);
10121012

10131013
if (rc & WL_POSTMASTER_DEATH)
1014-
return BGWH_POSTMASTER_DIED;
1014+
{
1015+
status = BGWH_POSTMASTER_DIED;
1016+
break;
1017+
}
10151018

10161019
ResetLatch(&MyProc->procLatch);
10171020
}

0 commit comments

Comments
 (0)