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.
This commit is contained in:
Robert Haas 2014-07-30 11:25:58 -04:00
parent 232f1475dc
commit e280c630a8
1 changed files with 3 additions and 0 deletions

View File

@ -4668,6 +4668,9 @@ SubPostmasterMain(int argc, char *argv[])
{
int shmem_slot;
/* do this as early as possible; in particular, before InitProcess() */
IsBackgroundWorker = true;
/* Close the postmaster's sockets */
ClosePostmasterPorts(false);