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 1hOw9n-0008BO-FI for pgsql-general@arkaria.postgresql.org; Fri, 10 May 2019 03:25:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hOw9l-0003oA-TL for pgsql-general@arkaria.postgresql.org; Fri, 10 May 2019 03:25:09 +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 1hOw9l-0003ny-Fb; Fri, 10 May 2019 03:25:09 +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 1hOw9i-0003yZ-DM; Fri, 10 May 2019 03:25:08 +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 x4A3P1Ln032705; Thu, 9 May 2019 23:25:01 -0400 From: Tom Lane To: neeraj kumar cc: Jeremy Schneider , pgsql-admin@postgresql.org, pgsql-general@postgresql.org Subject: Re: Query on pg_stat_activity table got stuck In-reply-to: References: <15877.1557178386@sss.pgh.pa.us> <21502.1557339176@sss.pgh.pa.us> <29660.1557352732@sss.pgh.pa.us> <30687.1557432052@sss.pgh.pa.us> Comments: In-reply-to neeraj kumar message dated "Thu, 09 May 2019 16:35:37 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32703.1557458701.1@sss.pgh.pa.us> Date: Thu, 09 May 2019 23:25:01 -0400 Message-ID: <32704.1557458701@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk neeraj kumar writes: > We got more information about this issue. There is one backend process > still present into beentry which has changecount as odd value. However this > process is long gone/terminated. It means when this process was > killed/terminated its entry was not cleaned from beentry list. There seems > to be some shutdown hook which cleans beentry if process is > killed/terminated that somehow was not kicked off ? No, that's the point: there isn't any such cleanup code. The design idea here was that we'd only have short straight-line code segments with no possible way to throw an error while changecount is odd. Then somebody abused the heck out of that ... regards, tom lane