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

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: (view raw, whole thread or download thread mbox)
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

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 );


pgsql-bugs by date

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

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