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

Commit c1d6ee8

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 4c27511 commit c1d6ee8

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
@@ -1025,13 +1025,16 @@ WaitForBackgroundWorkerShutdown(BackgroundWorkerHandle *handle)
10251025

10261026
status = GetBackgroundWorkerPid(handle, &pid);
10271027
if (status == BGWH_STOPPED)
1028-
return status;
1028+
break;
10291029

10301030
rc = WaitLatch(&MyProc->procLatch,
10311031
WL_LATCH_SET | WL_POSTMASTER_DEATH, 0);
10321032

10331033
if (rc & WL_POSTMASTER_DEATH)
1034-
return BGWH_POSTMASTER_DIED;
1034+
{
1035+
status = BGWH_POSTMASTER_DIED;
1036+
break;
1037+
}
10351038

10361039
ResetLatch(&MyProc->procLatch);
10371040
}

0 commit comments

Comments
 (0)