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

Re: client socket TIME_WAIT state after PQfinish

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Guillaume Du Pasquier <guillaume(dot)dupasquier(at)sensometrix(dot)ch>
Cc: Nicolas Barbier <nicolas(dot)barbier(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: client socket TIME_WAIT state after PQfinish
Date: 2010-09-27 17:33:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Mon, Sep 27, 2010 at 12:56 PM, Guillaume Du Pasquier
<guillaume(dot)dupasquier(at)sensometrix(dot)ch> wrote:
> Dear Nicolas, Dear Robert,
> Thank you for your quick answers.
> We do not have such behavior using SSL, how do you explain it ?
> I suppose that openssl is using the setsockopt SO_LINGER that
> removes this behavior. Therefore, there is a RST sent to close
> the socket.
> We work with an environment that uses a lot of socket connections.
> Therefore, many file descriptors are opened. If after each
> Sql requests a TIME_WAIT arises we will end up with many
> file descriptors opened. By default the maximum number of file descriptors
> is set to 1024 and we reach that number quite fast.

Hrm.  Does a socket in the TIME_WAIT state count against the number of
open file descriptors?  Certainly, it shouldn't count against the
per-process limit, as the process has already closed it.

> Do you have any advices to get rid of this TIME_WAIT problem ?
> Our client runs on the same machine as the postgresql server.
> Would it be possible to use PF_UNIX sockets ?

Yeah, actually that's the default, if you just run "psql" with no
parameters.  It looks for a socket in /tmp/.s.PGSQL.5432.

Robert Haas
The Enterprise Postgres Company

In response to


pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2010-09-27 17:34:00
Subject: Re: trailing whitespace in psql table output
Previous:From: Robert HaasDate: 2010-09-27 17:27:35
Subject: Re: PlaceHolderVars versus join ordering

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