postgres.git / summary / log / commit / refs

commit    c6ea616ff702862fc6923323a49dd24a0e0ae2d9
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Tue Aug 02 22:39:14 2016 +0000
First released in: 9.6.0, 9.5.4

    Remove duplicate InitPostmasterChild() call while starting a bgworker.
    
    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: <CAEepm=1VOnbVx4wsgQFvj94hu9jVt2nVabCr7QiooUSvPJXkgQ@mail.gmail.com>


src/backend/postmaster/postmaster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 19d11e0e0da..1813f8ca1d1 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -4806,8 +4806,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); @@ -4820,8 +4818,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) [parent: a253a88594f6]