Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHIUS-00011R-84 for pgsql-general@arkaria.postgresql.org; Wed, 22 Nov 2017 00:02:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHIUR-0001CG-4X for pgsql-general@arkaria.postgresql.org; Wed, 22 Nov 2017 00:02:07 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eHIUQ-0001C5-R6 for pgsql-general@lists.postgresql.org; Wed, 22 Nov 2017 00:02:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eHIUN-0006f6-Pt for pgsql-general@postgresql.org; Wed, 22 Nov 2017 00:02:05 +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 vAM021bs007807; Tue, 21 Nov 2017 19:02:01 -0500 From: Tom Lane To: andres@anarazel.de (Andres Freund) cc: Justin Pryzby , pgsql-general@postgresql.org Subject: Re: backends stuck in "startup" In-reply-to: <20171121235239.5ssxkvmfwvhxavsm@alap3.anarazel.de> References: <20171121230926.GA17194@telsasoft.com> <6177.1511306476@sss.pgh.pa.us> <20171121234558.p7rtwkasqfjvpft4@alap3.anarazel.de> <7332.1511308205@sss.pgh.pa.us> <20171121235239.5ssxkvmfwvhxavsm@alap3.anarazel.de> Comments: In-reply-to andres@anarazel.de (Andres Freund) message dated "Tue, 21 Nov 2017 15:52:39 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7805.1511308921.1@sss.pgh.pa.us> Date: Tue, 21 Nov 2017 19:02:01 -0500 Message-ID: <7806.1511308921@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk andres@anarazel.de (Andres Freund) writes: > On 2017-11-21 18:50:05 -0500, Tom Lane wrote: >> (If Justin saw that while still on 9.6, then it'd be worth looking >> closer.) > Right. I took this to be referring to something before the current > migration, but I might have overinterpreted things. There've been > various forks/ports of pg around that had hand-coded replacements with > futex usage, and there were definitely buggy versions going around a few > years back. Poking around in the archives reminded me of this thread: https://www.postgresql.org/message-id/flat/14947.1475690465@sss.pgh.pa.us which describes symptoms uncomfortably close to what Justin is showing. I remember speculating that the SysV-sema implementation, because it'd always enter the kernel, would provide some memory barrier behavior that POSIX-sema code based on futexes might miss when taking the no-wait path. I'd figured that any real problems of that sort would show up pretty quickly, but that could've been over optimistic. Maybe we need to take a closer look at where LWLocks devolve to blocking on the process semaphore and see if there's any implicit assumptions about barriers there. regards, tom lane