pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kris Jurka <books@ejurka.com>
Cc: Laurent Sylvain <sylvain.laurent@elca.ch>
Cc: 'pgsql-jdbc@postgresql.org' <pgsql-jdbc@postgresql.org>
Subject: Re: Bug (and fix): leaks of TCP connections when connected
Date: Mon, 21 Jun 2004 21:42:32 -0400
Message-ID: <8806.1087868552@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.BSO.4.56.0406211427440.7190@leary.csoft.net>
References: <A13B47F8EC3FD111A91500C04FD2A2820567E6FA@exchange.elca.ch>
	<Pine.BSO.4.56.0406211427440.7190@leary.csoft.net>

Kris Jurka <books@ejurka.com> writes:
> I'm not much of an expert on TCP, so could you give me a little more
> background on this?  I've duplicated the behavior you describe and I
> believe your fix is correct, but I'd like to understand this better.  
> First why is this a problem, the CLOSE_WAIT entries disappear rather
> quickly.  Second the number of CLOSE_WAIT items is nothing compared to the 
> number of TIME_WAIT entries, why aren't they a problem?

I think CLOSE_WAIT means that the kernel knows the far end has closed
the connection, but it's not yet been able to tell the local client so
(the vice-versa case may be called this too, not sure).  This state can
persist indefinitely if the client is uncooperative.  TIME_WAIT is a
short-lived state; the connection will be forgotten completely after the
timeout, which I think is order-of-a-minute.  (TIME_WAIT exists only so
that the kernel remembers what to do with any delayed packets that may
arrive from the far end.)

Bottom line is that CLOSE_WAIT means that a client bug is keeping the
kernel from freeing resources.  You don't want to see that.

			regards, tom lane



view thread (10+ messages)  latest in thread

Message-ID: <8806.1087868552@sss.pgh.pa.us>
Permalink:  ../8806.1087868552@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8806.1087868552@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: tgl@sss.pgh.pa.us, books@ejurka.com, sylvain.laurent@elca.ch
  Subject: Re: Bug (and fix): leaks of TCP connections when connected
  In-Reply-To: <8806.1087868552@sss.pgh.pa.us>
  References: <A13B47F8EC3FD111A91500C04FD2A2820567E6FA@exchange.elca.ch> <Pine.BSO.4.56.0406211427440.7190@leary.csoft.net> <8806.1087868552@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox