BUG #4602: child processes inherit database socket

From: "Jasen Betts" <jasen(at)treshna(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4602: child processes inherit database socket
Date: 2009-01-06 09:56:34
Message-ID: 200901060956.n069uYVX036518@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4602
Logged by: Jasen Betts
Email address: jasen(at)treshna(dot)com
PostgreSQL version: 8.3
Operating system: linux
Description: child processes inherit database socket
Details:

libpq creates sockets to the server without CLOEXEC.

as a result child processes inherit instances of the database socket

this wastes resources, and in some cases seems to keep the backend around
after the client has expired.

unless there's a reaon why duplicating the sockets is useful it can be
stopped like this:

{
int dflags = fcntl( socket_fd, F_GETFD );
fcntl( socket_fd, F_SETFD , dflags | CLOEXEC );
}

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-01-06 13:15:14 Re: BUG #4602: child processes inherit database socket
Previous Message Tom Lane 2009-01-06 00:03:14 Re: Status of issue 4593