Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQf0r-0006UH-Qy for pgsql-bugs@arkaria.postgresql.org; Tue, 14 May 2019 21:31:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hQf0q-0007Rv-Hf for pgsql-bugs@arkaria.postgresql.org; Tue, 14 May 2019 21:31:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQf0q-0007Qg-5N for pgsql-bugs@lists.postgresql.org; Tue, 14 May 2019 21:31:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQf0n-0008H2-Sx for pgsql-bugs@lists.postgresql.org; Tue, 14 May 2019 21:31:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x4ELUvnb029645; Tue, 14 May 2019 17:30:57 -0400 From: Tom Lane To: Yuli Khodorkovskiy cc: pgsql-bugs@lists.postgresql.org, Peter Eisentraut Subject: Re: BUG #15804: Assertion failure when using logging_collector with EXEC_BACKEND In-reply-to: <26332.1557863524@sss.pgh.pa.us> References: <15804-3721117bf40fb654@postgresql.org> <27CD45B5-88F7-4A09-8B31-EFE41FC37FE1@crunchydata.com> <26332.1557863524@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 14 May 2019 15:52:04 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29643.1557869457.1@sss.pgh.pa.us> Date: Tue, 14 May 2019 17:30:57 -0400 Message-ID: <29644.1557869457@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > It might be better to give up the assertion in PGSharedMemoryNoReAttach, > and just make it work more like PGSharedMemoryDetach, ie "detach if > UsedShmemSegAddr is set, else do nothing". I don't remember for sure, > but if we do that, there might be no functional difference anymore > between those two functions, in which case we might as well merge 'em. Apropos of this: I notice that commit 57431a911 is already relying on PGSharedMemoryDetach to do the "right thing" here, because that gets called in the non-EXEC_BACKEND code path, cf SysLogger_Start: /* Drop our connection to postmaster's shared memory, as well */ dsm_detach_all(); PGSharedMemoryDetach(); I'm also not too happy that this comment doesn't mention the fact that we'd (now) only be attached to shmem in the case of a postmaster restart. BTW, it looks to me like dsm_detach_all doesn't get called anywhere in the EXEC_BACKEND case, which seems like a separate bug. regards, tom lane