unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Andrew Whatson <whatson@gmail.com>
Cc: hylophile@posteo.de, 59321@debbugs.gnu.org
Subject: bug#59321: ice-9's open-input-pipe is unexpectedly slow on some systems
Date: Sat, 26 Nov 2022 15:39:06 +0100	[thread overview]
Message-ID: <871qppaigl.fsf@gnu.org> (raw)
In-Reply-To: <CAPE069cGWUWXMChrB86MBXKvNXFMUZUJnv=qkj-aDxSUTv3ygA@mail.gmail.com> (Andrew Whatson's message of "Mon, 21 Nov 2022 14:22:52 +1000")

Hi Andrew,

Andrew Whatson <whatson@gmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> wrote:

[...]

>> Libguile opens all its own file descriptors at O_CLOEXEC (one omission
>> was recently fixed in 0aa1a9976fc3c6af4d1087e59d728cb8fe7d369a) so it
>> may be possible to remove that FD-closing loop.  There’s still the
>> possibility that application bug unwillingly leaks FDs, but we could
>> consider it’s none of our business.
>>
>> Thoughts?
>
> I agree with this approach in principle, but from what Tomas is saying
> it seems like it's not currently possible for applications to do the
> right thing in all cases.

OK.

[...]

> We also need equivalent functionality around SOCK_CLOEXEC.  It seems
> this is implemented for ‘accept’, but not ‘socket’ or ‘socketpair’.

It’s possible to use SOCK_CLOEXEC with ‘socket’ and ‘socketpair’
already, as in:

  (socket AF_INET (logior SOCK_CLOEXEC SOCK_STREAM) 0)

With commit 1d313bf5f0d296d766bd3a0e6d030df37c71711b, ‘pipe’ is also
covered.

So I think we have pretty much everything we need, at least starting
with 3.0.9.

> Python's PEP 433 contains a good explanation of the issues which can
> arise from leaked file descriptors:
> https://peps.python.org/pep-0433/#inherited-file-descriptors-issues
>
> Given the risks, I'm convinced that Guile's conservative approach is
> actually quite sensible.  It seems like the best path forward would be
> to implement platform-specific optimizations where possible.
>
> I've attached a draft patch which implements a fast-path on systems
> where "/proc/self/fd" is available.

The patch LGTM; it’s certainly an improvement on systems configured with
a high per-process FD limit.

Now, I believe use of ‘posix_spawn’ as proposed in
<https://issues.guix.gnu.org/52835> makes that unnecessary.  Let’s take
a closer look at that other patch and so we can see…

Thanks,
Ludo’.





  reply	other threads:[~2022-11-26 14:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 18:06 bug#59321: ice-9's open-input-pipe is unexpectedly slow on some systems hylophile
2022-11-18  4:49 ` Andrew Whatson
2022-11-18  5:52   ` tomas
2022-11-20 17:24   ` Ludovic Courtès
2022-11-20 19:00     ` tomas
2022-11-21  4:22     ` Andrew Whatson
2022-11-26 14:39       ` Ludovic Courtès [this message]
2022-12-08 12:02         ` Andrew Whatson
2022-12-08 14:34           ` Ludovic Courtès
2023-01-13 15:37           ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871qppaigl.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=59321@debbugs.gnu.org \
    --cc=hylophile@posteo.de \
    --cc=whatson@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).