Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzOEq-0004oW-Cn for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Oct 2017 14:32:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dzOEp-0007xH-Gv for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Oct 2017 14:31:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dzOEp-0007wK-51 for pgsql-hackers@postgresql.org; Tue, 03 Oct 2017 14:31:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dzOEi-0008Cm-AG for pgsql-hackers@postgresql.org; Tue, 03 Oct 2017 14:31:58 +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 v93EVgAn010841; Tue, 3 Oct 2017 10:31:42 -0400 From: Tom Lane To: Alvaro Herrera cc: Andres Freund , Andreas Seltenreich , pgsql-hackers@postgresql.org, Michael Paquier Subject: Re: [sqlsmith] stuck spinlock in pg_stat_get_wal_receiver after OOM In-reply-to: <20171003140714.ozcduitwplj3ropj@alvherre.pgsql> References: <20171003140714.ozcduitwplj3ropj@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 03 Oct 2017 16:07:14 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10839.1507041102.1@sss.pgh.pa.us> Date: Tue, 03 Oct 2017 10:31:42 -0400 Message-ID: <10840.1507041102@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Alvaro Herrera writes: > Fixed the pstrdup problem by replacing with strlcpy() to stack-allocated > variables (rather than palloc + memcpy as proposed in Michael's patch). +1 > Tom Lane wrote: >> I don't especially like the Asserts inside spinlocks, either. > I didn't change these. It doesn't look to me that these asserts are > worth very much as production code. OK. If we ever see these hit in the buildfarm I might argue for reconsidering, but without some evidence of that sort it's not worth much concern. >> I'm also rather befuddled by the fact that this code sets and clears >> walrcv->latch outside the critical sections. If that field is used >> by any other process, surely that's completely unsafe. If it isn't, >> why is it being kept in shared memory? > I think the latch is only used locally. Seems that it was only put in > shmem to avoid a separate variable ... Hm, I'm strongly tempted to move it to a separate static variable then. That's not a bug fix, so maybe it only belongs in HEAD, but is there value in keeping the branches in sync in this code? It sounded from your commit message like they were pretty different already :-( regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers