Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sxom3-00Ccde-Dk for pgsql-general@arkaria.postgresql.org; Mon, 07 Oct 2024 14:31:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sxom1-00Bao8-R2 for pgsql-general@arkaria.postgresql.org; Mon, 07 Oct 2024 14:31:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sxom1-00Bao0-3W for pgsql-general@lists.postgresql.org; Mon, 07 Oct 2024 14:31:45 +0000 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sxoly-002xra-20 for pgsql-general@postgresql.org; Mon, 07 Oct 2024 14:31:43 +0000 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfhigh.phl.internal (Postfix) with ESMTP id 27C4111400AC; Mon, 7 Oct 2024 10:31:41 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-08.internal (MEProxy); Mon, 07 Oct 2024 10:31:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1728311501; x= 1728397901; bh=H84rGN7sdouGN3FTqldJz8x5tPtn2GOQbo2g2ulpLNo=; b=K Wf8J/tcIYUewc8sF6BtvAMFiUGk3cU5sGSFQhwZ8170xsJUj4S73vZFAuvUHOvpR Q55ZKrppFJyrsAdLuUYD6wcOA0OM4QOoPh643ai1bXELuDHavvj0ecdG9gRdLKcn /n05W66RbNAObUoBck2EUxMiIBRmAduziUxMbcvJPl87W1v4gxQbWR76rYK0apTJ lBVgl3CD7/k1/QH9FmM+uT5zJ05SDgJiQ+xbo8gg+js+7O/hxdFIWshZiG1YbTfU uf1Uf7yoSvV/xDC7UgiM4w09qh/RWT0dDE3qPV00sxmnUHdsslXYntlpIxlsCo77 IJdef6BqQzPY0VoGorvoA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddvledgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvve fukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghr rgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqeenucggtffrrghtth gvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeejkeffgfdufffhudffffeu veenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhv hhdrnhhoqdhiphdrohhrghdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohepkhhktghhnhdrihhnsehgmhgrihhlrdgtohhmpdhrtghpthhtohep phhgshhqlhdqghgvnhgvrhgrlhesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Oct 2024 10:31:40 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1728311498; bh=KVAAKD/9OmE2BGaNuUJpXYpEmeIkwQjs92i//bR2DVs=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Fp/fd/el3oa1quvJSJQkBACiXm+B3zoO7WdbqFh0fxzVMKL0HUUxTbltOcpCR45+t Q9N5Pniv0ZXDgDzROh4lJXiyjVrWwAs3rVYoH97HSjCVpljpsd3BIb7I/RdYglTRbc v+Ad2E0I3PYaLMksZE2V2rsI5r1qtycSVZtmOXCpmkiRX1R5iJ2fyVt7lL8j6s9Jul P9CJ0rQFidjzvCK8pFnWzOkXxOySZUnXkSIhHYFls2689x+y1LuYuLRYcmdh5o5LSx DM0qsXmUdyprmkkZ2pnodZdYn+/wck1lgmbcvUEfmg7u/xqTHMIgImZlZl0SVJZkQT V3gF5TBfxkktg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id D334EAC; Mon, 7 Oct 2024 16:31:38 +0200 (CEST) Date: Mon, 7 Oct 2024 16:31:38 +0200 From: Alvaro Herrera To: KK CHN Cc: pgsql-general Subject: Re: CLOSE_WAIT pileup and Application Timeout Message-ID: <202410071431.gxa5tcmlsojb@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Oct-07, KK CHN wrote: > On Mon, Oct 7, 2024 at 12:07 AM Alvaro Herrera > wrote: > Where do I have to introduce the TCP keepalives ? in the OS level or > application code level ? > > [root@dbch wildfly-27.0.0.Final]# cat /proc/sys/net/ipv4/tcp_keepalive_time > 7200 > [root@dbch wildfly-27.0.0.Final]# cat /proc/sys/net/ipv4/tcp_keepalive_intvl > 75 > [root@dbch wildfly-27.0.0.Final]# cat > /proc/sys/net/ipv4/tcp_keepalive_probes > 9 > [root@dbch wildfly-27.0.0.Final]# > > These are the default values in the OS level. Do I need to reduce all the > above three values to say 600, 20, 5 ? Or need to be handled in the > application backend code ? My understanding is that these values have no effect unless the socket gets setsockopt( ... , SO_KEEPALIVE, ...) So that's definitely something that the app needs to do -- it's not enabled automatically. With these default settings, the connection would be closed about 2:11 after going quiet, so if your problem manifests only a week later, you would have enough time for these to be cleaned up. But of course you should monitor what happens. > > I wonder if the connections from Wildfly to Postgres use SSL? Because > > there are reported cases where TCP connections are kept and accumulate, > > causing problems -- but apparently SSL is a necessary piece for that to > > happen. > > > No SSL in between Wildfly (8080 ) to PGSQL(5432). Okay, that's unlikely to be relevant then. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Linux transformó mi computadora, de una `máquina para hacer cosas', en un aparato realmente entretenido, sobre el cual cada día aprendo algo nuevo" (Jaime Salinas)