Skip site navigation (1) Skip section navigation (2)

Re: dangling connections

From: Daryl Stultz <daryl(dot)stultz(at)opentempo(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: dangling connections
Date: 2012-05-16 11:38:07
Message-ID: CANYnOKSk0MS2zNW45tKMvKMEBa-HdQp9nG0S25PVDLznaEhrDg@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-admin
>
>
> On Tue, May 15, 2012 at 3:31 AM, Sergey Konoplev <gray(dot)ru(at)gmail(dot)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(dot)stultz(at)opentempo(dot)com

In response to

Responses

pgsql-admin by date

Next:From: David SchnurDate: 2012-05-16 18:52:44
Subject: What does a .1 suffix on a PG data file signify?
Previous:From: Daryl StultzDate: 2012-05-15 11:47:09
Subject: Re: dangling connections

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group