Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHZk6-0003lk-6u for pgsql-general@arkaria.postgresql.org; Wed, 22 Nov 2017 18:27:26 +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 1eHZk5-00072m-71 for pgsql-general@arkaria.postgresql.org; Wed, 22 Nov 2017 18:27:25 +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 1eHZk5-00072c-1G for pgsql-general@lists.postgresql.org; Wed, 22 Nov 2017 18:27:25 +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.89) (envelope-from ) id 1eHZjx-0002be-0v for pgsql-general@postgresql.org; Wed, 22 Nov 2017 18:27:24 +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 vAMIRCrv027868; Wed, 22 Nov 2017 13:27:12 -0500 From: Tom Lane To: Justin Pryzby cc: Andres Freund , pgsql-general@postgresql.org Subject: Re: backends stuck in "startup" In-reply-to: <20171122064702.GQ5668@telsasoft.com> References: <20171121230926.GA17194@telsasoft.com> <20171121234027.b4n4jlsfda42qb6r@alap3.anarazel.de> <20171122064702.GQ5668@telsasoft.com> Comments: In-reply-to Justin Pryzby message dated "Wed, 22 Nov 2017 00:47:02 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27866.1511375232.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 22 Nov 2017 13:27:12 -0500 Message-ID: <27867.1511375232@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Justin Pryzby writes: > On Tue, Nov 21, 2017 at 03:40:27PM -0800, Andres Freund wrote: >> Could you try stracing next time? > I straced all the "startup" PIDs, which were all in futex, without excep= tion: If you've got debug symbols installed, could you investigate the states of the LWLocks the processes are stuck on? My hypothesis about a missed memory barrier would imply that there's (at least) one process that's waiting but is not in the lock's wait queue and has MyProc->lwWaiting =3D=3D false, while the rest are in the wait queue a= nd have MyProc->lwWaiting =3D=3D true. Actually chasing through the list pointers would be slightly tedious, but checking MyProc->lwWaiting, and maybe MyProc->lwWaitMode, in each process shouldn't be too hard. Also verify that they're all waiting for the same LWLock (by address). I recognize Andres' point that on x86 lock-prefixed instructions should be full memory barriers, and at least on my Linux machines, there do seem to be lock-prefixed instructions in the fast paths through sem_wait and sem_post. But the theory fits the reported evidence awfully well, and we have no other theory that fits at all. [ in an earlier post: ] > BTW this is a VM run on a hypervisor managed by our customer: > DMI: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platfo= rm, BIOS 6.00 06/22/2012 Hmm. Can't avoid the suspicion that that's relevant somehow. regards, tom lane