Remove duplicate InitPostmasterChild() call while starting a bgworker.
authorTom Lane
Tue, 2 Aug 2016 22:39:14 +0000 (18:39 -0400)
committerTom Lane
Tue, 2 Aug 2016 22:39:14 +0000 (18:39 -0400)
This is apparently harmless on Windows, but on Unix it results in an
assertion failure.  We'd not noticed because this code doesn't get
used on Unix unless you build with -DEXEC_BACKEND.  Bug was evidently
introduced by sloppy refactoring in commit 31c453165.

Thomas Munro

Discussion: 

src/backend/postmaster/postmaster.c

index c576986c6b2cd77cdf520fa08f5fe58d675826d2..975b98790dae1ccf2dea97c842e6cded9b9b4c23 100644 (file)
@@ -4787,8 +4787,6 @@ SubPostmasterMain(int argc, char *argv[])
        /* do this as early as possible; in particular, before InitProcess() */
        IsBackgroundWorker = true;
 
-       InitPostmasterChild();
-
        /* Close the postmaster's sockets */
        ClosePostmasterPorts(false);
 
@@ -4801,8 +4799,10 @@ SubPostmasterMain(int argc, char *argv[])
        /* Attach process to shared data structures */
        CreateSharedMemoryAndSemaphores(false, 0);
 
+       /* Fetch MyBgworkerEntry from shared memory */
        shmem_slot = atoi(argv[1] + 15);
        MyBgworkerEntry = BackgroundWorkerEntry(shmem_slot);
+
        StartBackgroundWorker();
    }
    if (strcmp(argv[1], "--forkarch") == 0)