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 1swggi-005RiQ-4q for pgsql-general@arkaria.postgresql.org; Fri, 04 Oct 2024 11:41:37 +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 1swgge-00Fbnp-QB for pgsql-general@arkaria.postgresql.org; Fri, 04 Oct 2024 11:41:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1swgge-00Fbnh-AL for pgsql-general@lists.postgresql.org; Fri, 04 Oct 2024 11:41:32 +0000 Received: from mail-yw1-x1134.google.com ([2607:f8b0:4864:20::1134]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1swgga-002VA7-Fi for pgsql-general@postgresql.org; Fri, 04 Oct 2024 11:41:31 +0000 Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-6e2b9e945b9so14922697b3.0 for ; Fri, 04 Oct 2024 04:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728042088; x=1728646888; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=cWfaoq5nWvVd2sA0jh5oPCaVNh0jLPIuW/arGEgwO5Y=; b=j5+k7kT0RffYHaO6cp6Zfyz89OxdV3M6OD11SnCQLU6AQ0qVb++le4IEiIcFJz29zv pzcodTdLoAZxvfulei+/A6EzdvuD5j2eiPmVd51PHalVT40MKqX5JjAHyf7dKspZdwmK oIIYPjboeBVfiKc2uAjvBqDrhFWqXuPzP8jVF1bDx0axHWofTCNj5Q7VGhGcrrs+crRp y6lm24Zfy7qrzSX61b+qsND0VHzxjt0/CVSH+hkBsqkBthrJgUYTAXu1PyR22JMi2PnI 49nTdx7EcOiZD/tysHj+RgKGYmisD3Gf+PqIGEX1HVeFw+aRWSNogbLdno09nHNnmDk2 PmLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728042088; x=1728646888; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cWfaoq5nWvVd2sA0jh5oPCaVNh0jLPIuW/arGEgwO5Y=; b=XgVUiD43owlZ9Dy9Qc+P4BvM/EqY4E2jqaC+ywobt5u+VtsyC5az2jVHBwBIhSdn4B KlXsgTMm2w9TX2u0FmVUjO/qBO4NAKYW4acZ+qVONGKA69STBy/qLmjwEci/JBp+6S3+ sTTlhH2RqLKa0XQJC7sB+gI6kGvemG2INKCLdLrIwsvsV9RlPMKrYgfBPRx1mgtmhr70 S/AQjnjSH4b1T4lm5+8luKtFpnwUdIpLtm6RrNqYU0JGx3j2fZCjFMOD4PmUo8tGdI/l eLRGq7P1Hs1IESj0tfkF8hJzpPZ6pKfwEAJEKTZ6dmsr8j7963M1QmyQBEsn5uLB+1kW J+yQ== X-Gm-Message-State: AOJu0YxNY0sXx4odZI53y/xaYVy75yMvf0tXhSgeKKvKjbGbBDe0zEI6 kpFdNpmDM9JNFDg6bvl84uNv58vpq94eKbc20Zk7YWQ0A9zJ1XAtWAEPhX+L0/yxa038YJz3Bij faDkV5bEY4PKD8nd6GZHjlIFHJhU= X-Google-Smtp-Source: AGHT+IHbf0Uh35AhVKSRSe7WkDDv3fCPH7mNVXgNnRvmRiZ1QiIafSrcIO1i19jWS1AARz0YLqGyk50t+3C+mMpcOIk= X-Received: by 2002:a05:690c:2d87:b0:6e2:5d2:3421 with SMTP id 00721157ae682-6e2c6ff7abbmr15401217b3.10.1728042087669; Fri, 04 Oct 2024 04:41:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Francesco Benetton Date: Fri, 4 Oct 2024 13:41:16 +0200 Message-ID: Subject: Re: CLOSE_WAIT pileup and Application Timeout To: KK CHN Cc: pgsql-general Content-Type: multipart/alternative; boundary="000000000000cae9cb0623a526db" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000cae9cb0623a526db Content-Type: text/plain; charset="UTF-8" If I understand clearly, postgresql is used as a Data server for the backend, and so the Android app does not connect directly to postgresql. The first idea is a problem on closing or recycling the connection by the backend after executing the request. Maybe wrong client connection pooling settings? Il ven 4 ott 2024, 06:29 KK CHN ha scritto: > List, > > I am facing a network (TCP IP connection closing issue) . > > Running a mobile tablet application, Android application to update the > status of vehicles fleet say around 1000 numbers installed with the app on > each vehicle along with a vehicle tracking application server solution > based on Java and Wildfly with PosrgreSQL16 backend. > > The mobile tablets are installed with the android based vehicle > tracking app which updated every 30 seconds its location fitted inside the > vehicle ( lat long coordinates) to the PostgreSQL DB through the java > backend application to know the latest location of the vehicle and its > movement which will be rendered in a map based front end. > > The vehicles on the field communicate via 443 to 8080 of the Wildfly > (version 27 ) deployed with the vehicle tracking application developed with > Java(version 17). > > > * The mobile tablet communicates to the backend application over mobile > data (4G/5G SIMS). * > > The running vehicles may disconnect or be unable to send the location > data in between if the mobile data coverage is less or absent in a > particular area where data coverage is nil or signal strength less. > > The server on which the backend application runs most often ( a week's > time or so) shows connection timeout and is unable to serve tracking of > the vehicles further. > > When we restart the Wildfly server the application returns to normal. > again the issue repeats after a week or two. > > In the Server machine when this bottleneck occurs I am seeing a lot of > TCP/IP CLOSE_WAIT ( 3000 to 5000 ) when the server backend becomes > unresponsive. > > What is the root cause of this issue ? Is it due to the android > application unable to send the CLOSE_WAIT ACK due to poor mobile data > connectivity ? > > > If so, how do people address this issue ? and what may be a fix ? > > Any directions / or reference material most welcome. > > Thank you, > Krishane > > > > > > --000000000000cae9cb0623a526db Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

If I understand clearly, postgresql is used as a Data server= for the backend, and so the Android app does not connect directly to postg= resql.
The first idea is a problem on closing or recycling the connection by the b= ackend after executing the request. Maybe wrong client connection pooling s= ettings?


Il ven= 4 ott 2024, 06:29 KK CHN <kkchn.i= n@gmail.com> ha scritto:
List,

I am facing a=C2=A0 network (TCP IP = connection closing issue) .

Running a=C2=A0 mobile= tablet application, Android application to update the status of vehicles f= leet say around 1000 numbers installed with the app on each vehicle along= =C2=A0 with a=C2=A0 vehicle tracking=C2=A0 application server solution base= d on Java and Wildfly with=C2=A0 PosrgreSQL16=C2=A0backend.

<= /div>
The mobile tablets are installed with the android=C2=A0based vehi= cle tracking=C2=A0app which updated every 30 seconds its location fitted in= side the vehicle ( lat long coordinates) to the PostgreSQL DB through the j= ava=C2=A0 backend application to know the latest location of the vehicle an= d its movement which will be rendered in a map based front end.=C2=A0
=

The vehicles on the field communicate=C2=A0 via 443 to= =C2=A0 =C2=A08080 of the Wildfly (version 27 ) deployed with the vehicle tr= acking application=C2=A0developed with Java(version 17).


=C2=A0 The mobile tablet communicates to the backe= nd application over mobile data (4G/5G SIMS).=C2=A0

The=C2=A0=C2=A0running vehicles may disconnect=C2=A0 or be unable to = send the location data in between if the mobile data coverage is less or ab= sent in a particular area where data coverage is nil or signal strength=C2= =A0less.=C2=A0

The server on which the backend app= lication runs most often (=C2=A0a week's time=C2=A0 or so) shows connec= tion timeout and is unable to serve tracking=C2=A0 of=C2=A0 the vehicles fu= rther.

When we restart the=C2=A0 Wildfly server=C2= =A0 the application returns to normal.=C2=A0 again the issue repeats=C2=A0 = after a week or two.=C2=A0

In the Server machine w= hen this bottleneck occurs=C2=A0 I am seeing=C2=A0 a lot of=C2=A0 TCP/IP CL= OSE_WAIT=C2=A0 =C2=A0( 3000 to 5000 ) when the server backend becomes unres= ponsive.=C2=A0

What is the root cause of this issu= e ?=C2=A0 =C2=A0Is it due to the android application unable to send the CLO= SE_WAIT ACK due to poor mobile data connectivity ?=C2=A0


=C2=A0If so, how do people=C2=A0 address this issue ?= =C2=A0 and what may be a fix ?=C2=A0=C2=A0

=C2=A0A= ny=C2=A0 directions / or reference material most welcome.=C2=A0
<= br>
Thank you,
Krishane





--000000000000cae9cb0623a526db--