Re: Many connections lingering

От: Tom Lane
Тема: Re: Many connections lingering
Дата: ,
Msg-id: 2314.1113360715@sss.pgh.pa.us
(см: обсуждение, исходный текст)
Ответ на: Many connections lingering  (Slavisa Garic)
Ответы: Re: [PERFORM] Many connections lingering  (Greg Stark)
Список: pgsql-novice

Скрыть дерево обсуждения

Many connections lingering  (Slavisa Garic, )
 Re: Many connections lingering  (Tom Lane, )
  Re: [PERFORM] Many connections lingering  (Greg Stark, )
   Re: [PERFORM] Many connections lingering  (Tom Lane, )
   Re: [PERFORM] Many connections lingering  (Slavisa Garic, )
    Re: [PERFORM] Many connections lingering  (John DeSoi, )
    Re: [PERFORM] Many connections lingering  (Mark Lewis, )
 Re: [PERFORM] Many connections lingering  (Slavisa Garic, )

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


В списке pgsql-novice по дате сообщения:

От: "Cima"
Дата:
Сообщение: error handling
От: David Orme
Дата:
Сообщение: Re: SUMMARY - select top N entries from several groups