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 1iCpfZ-00069n-Hm for pgsql-general@arkaria.postgresql.org; Tue, 24 Sep 2019 18:36:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iCpfX-0003rR-9Y for pgsql-general@arkaria.postgresql.org; Tue, 24 Sep 2019 18:36:11 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iCpfW-0003rJ-H8 for pgsql-general@lists.postgresql.org; Tue, 24 Sep 2019 18:36:11 +0000 Received: from resqmta-ch2-06v.sys.comcast.net ([2001:558:fe21:29:69:252:207:38]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iCpfQ-0002QV-6n for pgsql-general@lists.postgresql.org; Tue, 24 Sep 2019 18:36:09 +0000 Received: from resomta-ch2-16v.sys.comcast.net ([69.252.207.112]) by resqmta-ch2-06v.sys.comcast.net with ESMTP id Cl5Nin9efkYKGCpfLiK60w; Tue, 24 Sep 2019 18:35:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=20190202a; t=1569350159; bh=7MfJlZxKct1nRoKZoUmzBMe/bSYUhGCRkmM98lMwBhk=; h=Received:Received:Received:From:To:Subject:Date:Message-ID: MIME-Version:Content-Type; b=tgbPovDwbXPdO9mmhnKJt3GT31BHj7Hjn5OqsO56sc9xp3MXSACOGLZzdJat+HBnn 8Tl/IiuKpzc14S/r39k4cWRJJo2Gc7NJy9bAx3RkDGx9YxMhV3PahA43Kie1KMA2n0 xvyvowHRSI6CIRztYNZlM7iqhk7o7Rd+MnFnXdc9Gls2VkamrIN1Iq5lWwsqUnlDdW 3XBb+Eeyjyhr1/yGB9iulrUro65abeJ+Bu1jZS0RNadj0vQ1nfwsCLxBfvIrQ3Kjlo F0kTZKztSGxZZq5/GC9b9gIZfd1JejEoD7Y0UeHNWcy85z22OspvItqjZdb1wu8y6N 3FRlF1UGEsF6w== Received: from jsievers.comcast.net ([12.187.116.132]) by resomta-ch2-16v.sys.comcast.net with ESMTPA id CpfAiAVhUYom7CpfBix0kp; Tue, 24 Sep 2019 18:35:55 +0000 X-Xfinity-VAAS: gggruggvucftvghtrhhoucdtuddrgedufedrfedtgdduvdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuvehomhgtrghsthdqtfgvshhipdfqfgfvpdfpqffurfetoffkrfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufhffjgfkfgggtgfgsehtqhertddtreejnecuhfhrohhmpeflvghrrhihucfuihgvvhgvrhhsuceoghhsihgvvhgvrhhsudelsegtohhmtggrshhtrdhnvghtqeenucfkphepuddvrddukeejrdduudeirddufedvnecurfgrrhgrmhephhgvlhhopehjshhivghvvghrshdrtghomhgtrghsthdrnhgvthdpihhnvghtpeduvddrudekjedrudduiedrudefvddpmhgrihhlfhhrohhmpehgshhivghvvghrshduleestghomhgtrghsthdrnhgvthdprhgtphhtthhopegshhgrrhhgrghvphhoshhtghhrvghssehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-Xfinity-VMeta: sc=0;st=legit Received: from jsievers.enova.com (localhost [127.0.0.1]) by jsievers.comcast.net (Postfix) with ESMTP id CE8E626005A; Tue, 24 Sep 2019 13:35:48 -0500 (CDT) From: Jerry Sievers To: bhargav kamineni Cc: pgsql-general@lists.postgresql.org Subject: Re: pg_terminate_backend not working References: Date: Tue, 24 Sep 2019 13:35:48 -0500 In-Reply-To: (bhargav kamineni's message of "Tue, 24 Sep 2019 16:44:01 +0530") Message-ID: <87r245bkzf.fsf@jsievers.enova.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk bhargav kamineni writes: > Hi Team , > > We are observing long running process hung in active state on one of > our db from last two days with usename 'xyz', We have tried killing > the respective pid with pg_terminate_backned(pid), it's returning > true but the quires are not actually being terminated. Based on the > client address and port number from pg_stat_activity=C2=A0 we found the > connection origin and killed that connection initiation process from > that host , even after that the connections on db from=C2=A0 =C2=A0'xyz' = are > not getting terminated. Your client backend is most likely sitting in a blocked sys call such as network send, etc. Not sure though what is relaunching them after you say they were disabled some{where,how}. HTH > > and these connections are not making network calls a self dblink > connection is being established in the query. > > as a workaround we have disabled the connections initiation script > for xyz user and restarted the database=C2=A0=C2=A0right after restart we > observed the new connections from xyz user to database which is not=C2=A0 > expected because as we have=C2=A0 already disables the connections > initiation script. > > select =C2=A0pg_postmaster_start_time(); > =C2=A0 =C2=A0pg_postmaster_start_time =C2=A0 > ------------------------------ > =C2=A02019-09-24 06:44:07.41594+00 > > select usename,backend_start from pg_stat_activity where now() > -xact_start > '3 hours' and usename =3D'xyz'; > =C2=A0 =C2=A0 =C2=A0usename =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 b= ackend_start =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > -----------------+---------------------------- > =C2=A0xyz | 2019-09-24 06:44:38.879047+00 | > =C2=A0xyz | 2019-09-24 06:44:38.880501+00 | > =C2=A0xyz | 2019-09-24 06:44:38.881326+00 | > =C2=A0xyz | 2019-09-24 06:44:38.877561+00 | > =C2=A0xyz | 2019-09-24 06:44:38.878336+00 |=C2=A0 > > what could be the possible reason for these connections and > pg_termiante_backend(pid) not working ? > > Thanks,=C2=A0 > Bhargav K=C2=A0=C2=A0 > > > > --=20 Jerry Sievers Postgres DBA/Development Consulting e: postgres.consulting@comcast.net