Skip to content

Commit aeebacf

Browse files
committed
Fix mishandling of background worker PGPROCs in EXEC_BACKEND builds.
InitProcess() relies on IsBackgroundWorker to decide whether the PGPROC for a new backend should be taken from ProcGlobal's freeProcs or from bgworkerFreeProcs. In EXEC_BACKEND builds, InitProcess() is called sooner than in non-EXEC_BACKEND builds, and IsBackgroundWorker wasn't getting initialized soon enough. Report by Noah Misch. Diagnosis and fix by me.
1 parent 98c5fe5 commit aeebacf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4672,6 +4672,9 @@ SubPostmasterMain(int argc, char *argv[])
46724672
{
46734673
int shmem_slot;
46744674

4675+
/* do this as early as possible; in particular, before InitProcess() */
4676+
IsBackgroundWorker = true;
4677+
46754678
/* Close the postmaster's sockets */
46764679
ClosePostmasterPorts(false);
46774680

0 commit comments

Comments
 (0)