From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id uDgLMQL/QGZ5OgAAqHPOHw:P1 (envelope-from ) for ; Sun, 12 May 2024 19:40:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id uDgLMQL/QGZ5OgAAqHPOHw (envelope-from ) for ; Sun, 12 May 2024 19:40:18 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1715535618; a=rsa-sha256; cv=none; b=h1QGm7bRJZ6Fi409kqFjEzZFDtDOmjpGAcHG6JIKId34d1gVUVhAzy7Ha/ATZbeo9kauEh dykw0ntn/UmLymqpjaPqi4C5PJNjqwNU9Fs3HElo8lOMKoE/7gE6DlhrWrgcu9Ny7YQa+/ vrSXYJk91VIQ0KI6H6Dafcx+lSulJiUBPKl/xRp8y9rzZ6nd10cgh/r2pYPb+DiFS5F0ZM iN8PAmptWib/YSnCD3zIOGs6Q9uEKwiCjIeks564GxJsmGFE6vDpoPnbxRxHWHASrqg7VE Hc2PVcZAY+XAuN19+IAcmGYRFk6h/4rILYvvuF/0g2SSGp4ISKSM6Qq3aLCOPQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1715535618; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post; bh=E3fIOXoq89F0Pm9ZHzwJfOuau9XBF0jB3jyXObtm5ok=; b=amkhT/1hzuUtF3z7t5YyjFQ6uFv9Bvu3H6z3POjW5RoVrzdCm8tI4y9TjEPZYJ6vD5LeAc Nu6uNYUKjzHVSGZ65HZ/hFjz7V1A11fk92vBobJB0Z2tLNh84hFYtEZfg+oRZyW/Qfm7iw PMUzExn2iKN4lnpfMdaRQx3LWmxsEXsoMMteCDBxsgt41pXmjiQLDvkTDkbhUyNzQmrpAn qTd+eBJciGrT4HJ4qWOEKYNtLow/zHivoC7zSqqdjQXqv1xMFBNmALtmuYZ3REh6NxHmgM MsRoyckYZU8r390W9rjtrwm5ITDjDKIJZXsISIoF5b9Ht+hRnMPxus5D4qUs/g== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 90957380BA for ; Sun, 12 May 2024 19:40:18 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6DB7-0002hH-RD; Sun, 12 May 2024 13:40:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6DB4-0002fL-KQ for guix-patches@gnu.org; Sun, 12 May 2024 13:40:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s6DB4-0006oH-84 for guix-patches@gnu.org; Sun, 12 May 2024 13:40:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s6DB3-0006xl-JD for guix-patches@gnu.org; Sun, 12 May 2024 13:40:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#67245] [PATCH] store: Use a non-blocking socket for store connections. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 12 May 2024 17:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67245 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 67245@debbugs.gnu.org Received: via spool by 67245-submit@debbugs.gnu.org id=B67245.171553556326746 (code B ref 67245); Sun, 12 May 2024 17:40:01 +0000 Received: (at 67245) by debbugs.gnu.org; 12 May 2024 17:39:23 +0000 Received: from localhost ([127.0.0.1]:55565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6DAR-0006xK-4l for submit@debbugs.gnu.org; Sun, 12 May 2024 13:39:23 -0400 Received: from mira.cbaines.net ([212.71.252.8]:43450) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6DAM-0006x9-A9 for 67245@debbugs.gnu.org; Sun, 12 May 2024 13:39:21 -0400 Received: from localhost (unknown [45.67.83.168]) by mira.cbaines.net (Postfix) with ESMTPSA id E231A27BBE2; Sun, 12 May 2024 18:38:46 +0100 (BST) Received: from felis (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id d3c9ae88; Sun, 12 May 2024 17:38:44 +0000 (UTC) From: Christopher Baines In-Reply-To: <87fs0nndy9.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Thu, 30 Nov 2023 22:11:58 +0100") References: <460cdfa67b473ea2f1593668b2d9d0fd159378d0.1700244314.git.mail@cbaines.net> <87fs0s17op.fsf@gnu.org> <875y1nmrwf.fsf@cbaines.net> <87fs0nndy9.fsf@gnu.org> User-Agent: mu4e 1.12.2; emacs 29.3 Date: Sun, 12 May 2024 18:38:41 +0100 Message-ID: <87bk5b7wwu.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 90957380BA X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -8.47 X-Spam-Score: -8.47 X-TUID: YhKGFRZIcGnW --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s 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' optimizatio= n. >>>> - (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=E2=80=99s 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=E2=80=99re right. > > One issue is if we hand over the file descriptor to something that=E2=80= =99s not > Guile. Off the top of my head, this happens with inferiors and in the > =E2=80=98build=E2=80=99 procedure of =E2=80=98build-self.scm=E2=80=99 (we= ll, the process that receives > that file descriptor is Guile, but if it=E2=80=99s older than 3.0 (?), th= en it > may behave differently.) > > So it should be safe indeed, but adds a bit of overhead (hopping via > =E2=80=98current-{read,write}-waiter=E2=80=99) and needs good testing. > > Laziness gives an incentive for the status quo, but I=E2=80=99m not oppos= ed to > the change if we get more confidence (test suite passing, tests with > inferiors and =E2=80=98time-machine=E2=80=99, 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. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmZA/qFfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9Xfg6xAAs1SQRJtgIZUhwaIey4Fv1Moc4A0j8Rto 0QPVUBa3bqiXeAxyFkXTxSW4ke8jILjzhTcnmDk16lijmP+FPYN57JIVu0lLQDQf PkggqF8eJ0Te8born4s4v+5O601xKVH3zeZJl3BETIETVC+F4Rd7SbpmDxlAq10C PUaaoPRGphTdbLmgXc6srN7+tmSQFt4SiDMmv9vKNs1Wll47slEBRdacq7V8Gc+8 b5cdYXpOTloGhVFMf6ZJLnlm2kViy9LFKHKTciWej5xgutzwjUht2oQxGUeoYHV7 huFVHNAizYjM4k0uoGF8qi9jutev0PTvIWZ5b3GXih6iFtoZcFbyuqN3siqxYlnJ 1rKat5VYhqED8cHgg+73ywz+1n6B5gBXT+2tgdI98uAZ1vaD2M2f7taSIfHtjMio qQ035phm1MrGu3F8udtVoO4YCCHEq3Dj8MxSRd9m+q0c6KYwerkq2c5i8JFyGuT2 OPU5xSyjrn+A6ZWzxKHMIyisTD7X2tYmHE2W8cd8fzt7Fr4rimcHaLq69obmhhrb V9cZOqL4Ohtgd03BwLipq+GLEzSCFkbEFgqPJkDY06uXr3ZvPP2q+wLuTLQWj7IE mShUN8qKTjOVgZfwU6jKJofghAIBWUeBNRhYXKxsWsf0kUxWBkKd67shQPluyalI vwbaCfLqfKA= =/9YT -----END PGP SIGNATURE----- --=-=-=--