Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6Srw-0003Ym-Vm for pgsql-general@arkaria.postgresql.org; Thu, 22 Jul 2021 07:11:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m6Srv-00081Y-Rw for pgsql-general@arkaria.postgresql.org; Thu, 22 Jul 2021 07:11:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6Srv-00081Q-HF for pgsql-general@lists.postgresql.org; Thu, 22 Jul 2021 07:11:43 +0000 Received: from mout2.freenet.de ([2001:748:100:40::2:4]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6Srs-0001UY-C2 for pgsql-general@lists.postgresql.org; Thu, 22 Jul 2021 07:11:43 +0000 Received: from [195.4.92.123] (helo=sub4.freenet.de) by mout2.freenet.de with esmtpa (ID rissler.wolfgang@01019freenet.de) (port 25) (Exim 4.92 #3) id 1m6Srp-000V3j-BW; Thu, 22 Jul 2021 09:11:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freenet.de; s=mjaymdexmjqk; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:References:Cc:To:Subject:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=deDAxuOrI0BujLuzRI+RXOXAO6aH1/ZAsS6KRBAi7EE=; b=D6bMqToeTqHvXYC1oUQtZXWhu3 upZT6HLLdHZ2uVQ/5a5ZKaXtaEm3BvACOUpqK/gWCBx+dKqbDY1jYdsBKP68cxyxueXQI77qqMn4A QGWnFwmKxDab7c/r15KDcbW+rd01nu1Mb5VitgBvJDcfm3TwyIjctqDw/nUVhaIBB5ICO43YcX25g GZIrjL6nknDiz9ATkiWbK9hN4EtD9cnd6lv+bVoUSf+JnKslpfn4IZPOfkq1BsPxxqQDaMCpP0maL 8cQfDwEpiKjaAGiVTFxzseiuHQ+rM2NsI3p6yoGKSdefU3S+Bu20sdRPxiunMufziQXYrFABNsS+P 6uYPW3gg==; Received: from p200300fc1f03f20071ae2cc52e779003.dip0.t-ipconnect.de ([2003:fc:1f03:f200:71ae:2cc5:2e77:9003]:55263) by sub4.freenet.de with esmtpsa (ID rissler.wolfgang@01019freenet.de) (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (port 465) (Exim 4.92 #3) id 1m6Srp-0006In-9D; Thu, 22 Jul 2021 09:11:37 +0200 From: WR Subject: Re: Obsolete or dead serverconnections after reboot To: Vijaykumar Jain Cc: pgsql-general References: <9da9e765-9042-4f5e-00a1-4695d1244a47@freenet.de> Message-ID: <6f6a7f2c-b6fa-53bd-9b78-2299c7aa1bf2@freenet.de> Date: Thu, 22 Jul 2021 09:11:29 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Originated-At: 2003:fc:1f03:f200:71ae:2cc5:2e77:9003!55263 X-FNSign: v=2 s=DC782664C8C064EBCBB15FDD0E44AE055AF35B806FF42A0C45056C4D4CE5E7FE X-Scan-TS: Thu, 22 Jul 2021 09:11:37 +0200 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Vijaykumar Jain, at first: select pg_stat_reset(); doesn't help, the pg_stat_activity is the same after it. I added some interesting rows after two reboots (which have been complete power cycles) artea=# select pid ,application_name , client_addr ,client_port ,backend_start ,query_start,state from pg_stat_activity; pid | application_name | client_addr | client_port | backend_start | query_start | state -------+-----------------------------+---------------------------------------+-------------+-------------------------------+-------------------------------+-------- 11116 | | | | 2021-07-21 12:38:06.76295+02 | | 9320 | | | | 2021-07-21 12:38:06.77185+02 | | 11292 | psql | 2003:fc:1f03:f200:71ae:2cc5:2e77:9003 | 59545 | 2021-07-22 07:52:20.110569+02 | 2021-07-22 07:52:24.727718+02 | idle 9624 | arteasubartlt15wolleartlt34 | 2003:fc:1f03:f200:71ae:2cc5:2e77:9003 | 59574 | 2021-07-22 07:56:16.235684+02 | 2021-07-22 07:56:16.278479+02 | active 11396 | psql | 192.168.2.49 | 59550 | 2021-07-22 07:54:03.736197+02 | 2021-07-22 07:54:06.488585+02 | idle 10448 | psql | 2003:fc:1f03:f200:71ae:2cc5:2e77:9003 | 59589 | 2021-07-22 07:58:14.715886+02 | 2021-07-22 07:59:01.652215+02 | active 15788 | | | | 2021-07-21 12:38:06.736352+02 | | 11216 | | | | 2021-07-21 12:38:06.722957+02 | | 14092 | | | | 2021-07-21 12:38:06.739031+02 | | (9 Zeilen) (Sorry for bad formatting) So you can see we have two idle connections, which are those from before the reboots (one had a IPv4 name resolution and two did it by IPv6, psql commandline was the same). The backend_start is the same before and after reboot, so they are the same instances of connections. I scanned the logfiles and I did not find a shutdown of PostgresServer on reboot time. But when I restart the Windows-service postgres manually, then I get those messages: On stop: 2021-07-22 08:27:33.451 CEST [11216] LOG: fahre herunter (I'm shutting down) 2021-07-22 08:27:33.512 CEST [14000] LOG: Datenbanksystem ist heruntergefahren (DB is now shutdown) On start: 2021-07-22 08:27:39.565 CEST [11500] LOG: PostgreSQL 13.2, compiled by Visual C++ build 1914, 64-bit startet 2021-07-22 08:27:39.744 CEST [17304] LOG: Datenbanksystem wurde am 2021-07-22 08:27:33 CEST heruntergefahren (DB was shutdown on 2021-07-22 08:27:33) 2021-07-22 08:27:39.787 CEST [11500] LOG: Datenbanksystem ist bereit, um Verbindungen anzunehmen (DB is ready to accept connections) (sorry, its in german, tried to translate) So maybe, the DB-service seems not to stopped propperly on shutdown of the host? Greets, Wolfgang Am 21.07.2021 um 15:14 schrieb Vijaykumar Jain: > select pg_stat_reset(); -- May the source be with you