Re: dangling connections - Mailing list pgsql-admin

From Daryl Stultz
Subject Re: dangling connections
Date
Msg-id CANYnOKSk0MS2zNW45tKMvKMEBa-HdQp9nG0S25PVDLznaEhrDg@mail.gmail.com
Whole thread Raw
In response to Re: dangling connections  (Daryl Stultz <daryl.stultz@opentempo.com>)
Responses Re: dangling connections
List pgsql-admin

On Tue, May 15, 2012 at 3:31 AM, Sergey Konoplev <gray.ru@gmail.com> wrote:

select client_addr, client_port from pg_stat_activity;

after shutting down the Tomcat and find out what holds the <client_port> on
the <client_addr>

[user@<client_addr> ~]$ sudo netstat -pnao | grep <client_port>

The second column from the right will be the process pid.


My system is running fine at present, but I thought I'd just mess with the above. Oddly, it seems Tomcat is holding 56 connections while PG is holding only 51.

netstat -pnao | grep 5432 | sort | head

Tomcat server
tcp        0      0 ::ffff:172.16.103.122:33440 ::ffff:172.16.101.157:5432  ESTABLISHED 14423/java          off (0.00/0/0)
tcp        0      0 ::ffff:172.16.103.122:33441 ::ffff:172.16.101.157:5432  ESTABLISHED 14423/java          off (0.00/0/0)
tcp        0      0 ::ffff:172.16.103.122:33442 ::ffff:172.16.101.157:5432  ESTABLISHED 14423/java          off (0.00/0/0)
tcp        0      0 ::ffff:172.16.103.122:33443 ::ffff:172.16.101.157:5432  ESTABLISHED 14423/java          off (0.00/0/0)
tcp        0      0 ::ffff:172.16.103.122:33444 ::ffff:172.16.101.157:5432  ESTABLISHED 14423/java          off (0.00/0/0)
tcp        0      0 ::ffff:172.16.103.122:33775 ::ffff:172.16.101.157:5432  ESTABLISHED 14423/java          off (0.00/0/0)
tcp        0      0 ::ffff:172.16.103.122:33776 ::ffff:172.16.101.157:5432  ESTABLISHED 14423/java          off (0.00/0/0)
tcp        0      0 ::ffff:172.16.103.122:35117 ::ffff:172.16.101.157:5432  ESTABLISHED 14423/java          off (0.00/0/0)
tcp        0      0 ::ffff:172.16.103.122:35118 ::ffff:172.16.101.157:5432  ESTABLISHED 14423/java          off (0.00/0/0)
tcp        0      0 ::ffff:172.16.103.122:35119 ::ffff:172.16.101.157:5432  ESTABLISHED 14423/java          off (0.00/0/0)

Postgresql server
tcp        0      0 0.0.0.0:5432                0.0.0.0:*                   LISTEN      5666/postmaster     off (0.00/0/0)
tcp        0      0 172.16.101.157:5432         172.16.103.122:33775        ESTABLISHED 17410/postgres: otr keepalive (4815.62/0/0)
tcp        0      0 172.16.101.157:5432         172.16.103.122:33776        ESTABLISHED 17411/postgres: otr keepalive (4815.63/0/0)
tcp        0      0 172.16.101.157:5432         172.16.103.122:35117        ESTABLISHED 16921/postgres: pos keepalive (2277.28/0/0)
tcp        0      0 172.16.101.157:5432         172.16.103.122:35118        ESTABLISHED 16922/postgres: pos keepalive (2277.29/0/0)
tcp        0      0 172.16.101.157:5432         172.16.103.122:35119        ESTABLISHED 16923/postgres: otr keepalive (2280.08/0/0)
tcp        0      0 172.16.101.157:5432         172.16.103.122:35120        ESTABLISHED 16926/postgres: pos keepalive (2290.73/0/0)
tcp        0      0 172.16.101.157:5432         172.16.103.122:35121        ESTABLISHED 16927/postgres: pos keepalive (2290.73/0/0)
tcp        0      0 172.16.101.157:5432         172.16.103.122:35122        ESTABLISHED 16928/postgres: pos keepalive (2290.74/0/0)
tcp        0      0 172.16.101.157:5432         172.16.103.122:35123        ESTABLISHED 16929/postgres: pos keepalive (2290.74/0/0)

Note the bolded ports missing from the PG side. This is the opposite of the condition I originally presented. Anyone have an explanation for this?

--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
http://www.opentempo.com
mailto:daryl.stultz@opentempo.com

pgsql-admin by date:

Previous
From: Daryl Stultz
Date:
Subject: Re: dangling connections
Next
From: David Schnur
Date:
Subject: What does a .1 suffix on a PG data file signify?