The following bug has been logged online:
Bug reference: 4602
Logged by: Jasen Betts
Email address: jasen@treshna.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 );
}