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 1m69n4-00082T-5x for pgsql-general@arkaria.postgresql.org; Wed, 21 Jul 2021 10:49:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m69n3-00010U-4g for pgsql-general@arkaria.postgresql.org; Wed, 21 Jul 2021 10:49:25 +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 1m69n2-00010M-Q6 for pgsql-general@lists.postgresql.org; Wed, 21 Jul 2021 10:49:24 +0000 Received: from mout0.freenet.de ([2001:748:100:40::2:2]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.92) (envelope-from ) id 1m69n1-0008AZ-4B for pgsql-general@lists.postgresql.org; Wed, 21 Jul 2021 10:49:24 +0000 Received: from [195.4.92.123] (helo=sub4.freenet.de) by mout0.freenet.de with esmtpa (ID rissler.wolfgang@01019freenet.de) (port 25) (Exim 4.92 #3) id 1m69mx-0002yT-MM for pgsql-general@lists.postgresql.org; Wed, 21 Jul 2021 12:49:19 +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:MIME-Version:Date: Message-ID:Subject:From:To:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=6a4uCBbjFcK7IU4qSa7KtDL6/JktW2UyTsf84ttJIto=; b=yWUbd+NhX9GboRDXpeNVbDkB7x 8+H17nSU761X4tZx4tJwtyxbnUmOBU2P3st5oXCAt7k7+WnoPOB3fTOIHRGyprv9kmoyg2X53w8l2 PjgwNRuCBnRo2JtZrkzdVdWkVAuc1dpjXJF+ejm0XKGYN4cYlN7stKdwyJO0gK0MP05/0jQ1GyNEY A/d6SqczPnN5BG+5z6yiqLKzJZ9TVIvj65kl+Ihx346g7JQT1CeaONtDBCsIam0ON5ty7t1yyD7re HnJjoRJDfEV08yzNWk0BBNRUKmnXU7BHbO6LjCP1nea2A+z65lOE686ce5xr1xTciNYS4y4hhjBDe tPcxJtMw==; Received: from p200300fc1f03f20071ae2cc52e779003.dip0.t-ipconnect.de ([2003:fc:1f03:f200:71ae:2cc5:2e77:9003]:64220) 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 1m69my-00034g-02 for pgsql-general@lists.postgresql.org; Wed, 21 Jul 2021 12:49:20 +0200 To: pgsql-general@lists.postgresql.org From: WR Subject: Obsolete or dead serverconnections after reboot Message-ID: <9da9e765-9042-4f5e-00a1-4695d1244a47@freenet.de> Date: Wed, 21 Jul 2021 12:49:06 +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 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!64220 X-FNSign: v=2 s=904351F8AEBFCCA888AEEABB3979756D076C4BBA0370297434FC4B0DA3AE9CC6 X-Scan-TS: Wed, 21 Jul 2021 12:49:20 +0200 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello community, actually I have a problem wit PG13 on Windows 10 (both x64), Postgres version is 13.0.2.21090 from EDB installer. I have to develop a logical replication cluster, where sometimes there happens a shutdown of one host. Logical replication works nice, thank you for that. My issue is, when I do a normal Windows shutdown, when there are connections open to this database server and later this host comes up again in statistics I find the old connections from before shutdown. They don't go away and keep staying there over reboots. Only a restart of the Windows service throws them away. The problem is, that they block a place in der connections counter of the server and after a while I cant login any more, because the maximum user-connection count is exceeded. Example: select pid, datid, application_name, usename , client_addr from pg_stat_activity; before reboot (one active psql session, left it open on server shutdown): pid | datid | application_name | usename | client_addr -------+--------+------------------+----------+--------------------------------------- 13548 | 156501 | psql | postgres | 192.168.2.49 after reboot (and newly started psql session): pid | datid | application_name | usename | client_addr -------+--------+------------------+----------+--------------------------------------- 13548 | 156501 | psql | postgres | 192.168.2.49 13764 | 156501 | psql | postgres | 192.168.2.49 As we can see at pid column, the old connection is still there, but I have only on psql session open. After restarting the postgres service( and psql reconnect): pid | datid | application_name | usename | client_addr -------+-------+------------------+----------+--------------------------------------- 12132 | 91805 | psql | postgres | 192.168.2.49 Everything is like expected: one psql-session, one row in the statistics Is there a way to avoid this (without restarting the service after every reboot). Is this a bug or a normal behavior? Thank you, Wolfgang -- May the source be with you