]> granicus.if.org Git - postgresql/commitdiff
Fix mishandling of background worker PGPROCs in EXEC_BACKEND builds.
authorRobert Haas <rhaas@postgresql.org>
Wed, 30 Jul 2014 15:25:58 +0000 (11:25 -0400)
committerRobert Haas <rhaas@postgresql.org>
Wed, 30 Jul 2014 15:34:06 +0000 (11:34 -0400)
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.

src/backend/postmaster/postmaster.c

index 198c97ecf5d921c42f3c955eb03be78a7fea98ac..b190cf51136f4a9c753695c5c988ceb9946fb286 100644 (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);