From: Christopher Baines <mail@cbaines.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 67245@debbugs.gnu.org
Subject: [bug#67245] [PATCH] store: Use a non-blocking socket for store connections.
Date: Sun, 12 May 2024 18:38:41 +0100 [thread overview]
Message-ID: <87bk5b7wwu.fsf@cbaines.net> (raw)
In-Reply-To: <87fs0nndy9.fsf@gnu.org> ("Ludovic Courtès"'s message of "Thu, 30 Nov 2023 22:11:58 +0100")
[-- Attachment #1: Type: text/plain, Size: 1926 bytes --]
Ludovic Courtès <ludo@gnu.org> writes:
>>>> +++ b/guix/store.scm
>>>> @@ -460,7 +460,9 @@ (define (open-unix-domain-socket file)
>>>> '&store-connection-error' upon error."
>>>> (let ((s (with-fluids ((%default-port-encoding #f))
>>>> ;; This trick allows use of the `scm_c_read' optimization.
>>>> - (socket PF_UNIX (logior SOCK_STREAM SOCK_CLOEXEC) 0)))
>>>> + (socket PF_UNIX
>>>> + (logior SOCK_STREAM SOCK_CLOEXEC SOCK_NONBLOCK)
>>>> + 0)))
>>>
>>> We cannot do this here because callers have to be prepared to deal with
>>> non-blocking sockets, and that’s not the case in Guix itself.
>>
>> I can see potential problems for programs outside of Guix which use
>> suspendable ports, but given Guix doesn't use suspendable ports, this
>> won't change behaviour, right?
>>
>> Obviously Guile will be working a bit differently, using poll when it
>> needs to wait for I/O, but at the scheme level within Guix, things
>> should be no different.
>
> Hmm yes, I think you’re right.
>
> One issue is if we hand over the file descriptor to something that’s not
> Guile. Off the top of my head, this happens with inferiors and in the
> ‘build’ procedure of ‘build-self.scm’ (well, the process that receives
> that file descriptor is Guile, but if it’s older than 3.0 (?), then it
> may behave differently.)
>
> So it should be safe indeed, but adds a bit of overhead (hopping via
> ‘current-{read,write}-waiter’) and needs good testing.
>
> Laziness gives an incentive for the status quo, but I’m not opposed to
> the change if we get more confidence (test suite passing, tests with
> inferiors and ‘time-machine’, and some more auditing.)
Maybe we can just move the with-store/non-blocking in to Guix, as that
will solve the immediate issue.
I've sent a new patch for that.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]
next prev parent reply other threads:[~2024-05-12 17:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 18:05 [bug#67245] [PATCH] store: Use a non-blocking socket for store connections Christopher Baines
2023-11-26 22:16 ` Ludovic Courtès
2023-11-27 9:48 ` Christopher Baines
2023-11-30 21:11 ` Ludovic Courtès
2024-05-12 17:38 ` Christopher Baines [this message]
2024-05-11 16:53 ` [bug#67245] [PATCH v2] store: Add with-store/non-blocking Christopher Baines
2024-05-13 12:44 ` Ludovic Courtès
2024-05-13 19:32 ` bug#67245: " Christopher Baines
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://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bk5b7wwu.fsf@cbaines.net \
--to=mail@cbaines.net \
--cc=67245@debbugs.gnu.org \
--cc=ludo@gnu.org \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
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).