X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 484685295D; Tue, 12 Apr 2005 23:52:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40354-07; Wed, 13 Apr 2005 02:51:54 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6A06753848; Tue, 12 Apr 2005 23:51:53 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3D2ptc2002315; Tue, 12 Apr 2005 22:51:55 -0400 (EDT) To: Slavisa Garic Cc: pgsql-performance@postgresql.org, pgsql-novice@postgresql.org Subject: Re: Many connections lingering In-reply-to: References: Comments: In-reply-to Slavisa Garic message dated "Wed, 13 Apr 2005 12:29:53 +1000" Date: Tue, 12 Apr 2005 22:51:55 -0400 Message-ID: <2314.1113360715@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/158 X-Sequence-Number: 13041 Slavisa Garic writes: > ... Now, the > interesting behaviour is this. I've ran netstat on the machine where > my software is running and I searched for tcp connections to my PGSQL > server. What i found was hundreds of lines like this: > tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39504 TIME_WAIT > tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:40720 TIME_WAIT > tcp 0 0 remus.dstc.monash:43001 remus.dstc.monash:39135 TIME_WAIT This is a network-level issue: the TCP stack on your machine knows the connection has been closed, but it hasn't seen an acknowledgement of that fact from the other machine, and so it's remembering the connection number so that it can definitively say "that connection is closed" if the other machine asks. I'd guess that either you have a flaky network or there's something bogus about the TCP stack on the client machine. An occasional dropped FIN packet is no surprise, but hundreds of 'em are suspicious. > Now could someone explain to me what this really means and what effect > it might have on the machine (the same machine where I ran this > query)? Would there eventually be a shortage of available ports if > this kept growing? The reason I am asking this is because one of my > modules was raising exception saying that TCP connection could not be > establish to a server it needed to connect to. That kinda sounds like "flaky network" to me, but I could be wrong. In any case, you'd have better luck asking kernel or network hackers about this than database weenies ;-) regards, tom lane