Re: Use FD_CLOEXEC on ListenSockets (was Re: Refactoring backend fork+exec code)

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: Use FD_CLOEXEC on ListenSockets (was Re: Refactoring backend fork+exec code)
Дата
Msg-id CA+hUKGJAk=-9Ex+SEFPbgbeouW4+8XGCh9=3QGGqpXZ4P84i8w@mail.gmail.com
обсуждение исходный текст
Ответ на Use FD_CLOEXEC on ListenSockets (was Re: Refactoring backend fork+exec code)  (Heikki Linnakangas <hlinnaka@iki.fi>)
Ответы Re: Use FD_CLOEXEC on ListenSockets (was Re: Refactoring backend fork+exec code)  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-hackers
On Thu, Aug 24, 2023 at 11:41 PM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> On 11/07/2023 01:50, Andres Freund wrote:
> >> From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
> >> Date: Mon, 12 Jun 2023 16:33:20 +0300
> >> Subject: [PATCH 4/9] Use FD_CLOEXEC on ListenSockets
> >>
> >> We went through some effort to close them in the child process. Better to
> >> not hand them down to the child process in the first place.
> >
> > I think Thomas has a larger version of this patch:
> > https://postgr.es/m/CA%2BhUKGKPNFcfBQduqof4-7C%3DavjcSfdkKBGvQoRuAvfocnvY0A%40mail.gmail.com
>
> Hmm, no, that's a little different. Thomas added the FD_CLOEXEC option
> to the *accepted* socket in commit 1da569ca1f. That was part of that
> thread. This patch adds the option to the *listen* sockets. That was not
> discussed in that thread, but it's certainly in the same vein.
>
> Thomas: What do you think of the attached?

LGTM.  I vaguely recall thinking that it might be better to keep
EXEC_BACKEND and !EXEC_BACKEND working the same which might be why I
didn't try this one, but it looks fine with the comment to explain, as
you have it.  (It's a shame we can't use O_CLOFORK.)

There was some question in the other thread about whether doing that
to the server socket might affect accepted sockets too on some OS, but
I can at least confirm that your patch works fine on FreeBSD in an
EXEC_BACKEND build.  I think there were some historical disagreements
about which socket properties were inherited, but not that.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Dagfinn Ilmari Mannsåker
Дата:
Сообщение: Re: Adding argument names to aggregate functions
Следующее
От: Ashutosh Bapat
Дата:
Сообщение: Re: Infinite Interval