From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id MGCCH4pqZGVE5QAAauVa8A:P1 (envelope-from ) for ; Mon, 27 Nov 2023 11:08:10 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id MGCCH4pqZGVE5QAAauVa8A (envelope-from ) for ; Mon, 27 Nov 2023 11:08:10 +0100 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 4469F43B75 for ; Mon, 27 Nov 2023 11:08:10 +0100 (CET) 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=1701079690; a=rsa-sha256; cv=none; b=MtoeBmCSaFWqU7gsYE5AX1Nok5Nhu8sBO24XOWsi9lAOJl5DvOdel9t+LEa+S7qrmbobPU zdAJ6nhn1uUULE8fxoz6MdJ3tTenwOUVAtvb6WU5dqbDkH4sa3T3MZdRTpUajDa0d+MWZ0 sqU4TEgqf4WKjrCTjv95gKqAjmTJuXnxlHpDX5OSK818d+9r+MNRpB/JVlb3Ulf/Qi5NOP Upok5hGRPByNTI0zOF899p8LRQ0gKCZ67Ygt7Ga6stiAdEhM1SLicZTMM1nTOWnZc4zeH0 v8A+MIJYuMcdCk/TtBWEwkj8r06cg5eldnw+lWJ501LwVEJn0revhd5G7n1/6g== 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=1701079690; 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=EvLor2IHryvKRJqIMzeY73+6QHzknKceTguFv9pAZ5s=; b=cu3p6OMpSQA8c1cfQ8mcHR8+cNwDLj42YqpiGQ1QUzv9IZQ25Du8aehKCznMjuTIHkGzuB p0xtC6C4HsRGRM7dzTJU9xJEXAXiIG0yQwWdUcfa6Zyw4qUUh+7hynQtEh6XjPYReGltvm EHHBjJLynWkM/Xq0Tc4U8AvIVzjcvjISPLD14zCkBsPmb3YCGiRnIlGuIpPZlcmVk6ti8t Um02l8ldz+3n/kTW/alsAT8w1puQsuvHs2enpUAx46DJhjk2Pwl7iiXCODgmNaYeCob0dA Ra1ADvaBgREYFSLojbJ/pnqJhkOgVlhWS9peGBBv8RjemcrW7x1HhPbOvpo7sQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7YX0-0001WU-Hd; Mon, 27 Nov 2023 05:07:58 -0500 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 1r7YWy-0001W8-JO for guix-patches@gnu.org; Mon, 27 Nov 2023 05:07:56 -0500 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 1r7YWy-00065f-BC for guix-patches@gnu.org; Mon, 27 Nov 2023 05:07:56 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r7YX4-0008Ac-Ge for guix-patches@gnu.org; Mon, 27 Nov 2023 05:08:02 -0500 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: Mon, 27 Nov 2023 10:08:02 +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.170107963131350 (code B ref 67245); Mon, 27 Nov 2023 10:08:02 +0000 Received: (at 67245) by debbugs.gnu.org; 27 Nov 2023 10:07:11 +0000 Received: from localhost ([127.0.0.1]:43353 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7YWF-00089a-6h for submit@debbugs.gnu.org; Mon, 27 Nov 2023 05:07:11 -0500 Received: from mira.cbaines.net ([2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27]:55759) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7YWB-00089M-0v for 67245@debbugs.gnu.org; Mon, 27 Nov 2023 05:07:09 -0500 Received: from localhost (unknown [217.155.61.229]) by mira.cbaines.net (Postfix) with ESMTPSA id 236BE27BBE2; Mon, 27 Nov 2023 10:06:59 +0000 (GMT) Received: from felis (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 85636a02; Mon, 27 Nov 2023 10:06:58 +0000 (UTC) References: <460cdfa67b473ea2f1593668b2d9d0fd159378d0.1700244314.git.mail@cbaines.net> <87fs0s17op.fsf@gnu.org> User-agent: mu4e 1.10.7; emacs 29.1 From: Christopher Baines Date: Mon, 27 Nov 2023 09:48:09 +0000 In-reply-to: <87fs0s17op.fsf@gnu.org> Message-ID: <875y1nmrwf.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-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -8.20 X-Spam-Score: -8.20 X-Migadu-Queue-Id: 4469F43B75 X-TUID: cnX6yEYBwMg+ --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Hi Christopher, > > Christopher Baines skribis: > >> For some applications, it's important to do this here rather than just m= aking >> the socket non-blocking after the connection is established because ther= e can >> be I/O on the socket that will block during the handshake. >> >> I've noticed this blocking during the handshake causing issues in the bu= ild >> coordinator for example. >> >> * guix/store.scm (open-unix-domain-socket, open-inet-socket): Pass >> SOCK_NONBLOCK when calling socket. >> >> Change-Id: I8225762b78448bc1f7b698c8de5d736e13f577bf > > I feel we should really discuss on Guix + Fibers since we=E2=80=99ve appa= rently > been going through the exact same set of issues. :-) > > (The other thing that comes to mind is the resource pool!) I'm mostly ignoring these issues then coping the code once you write it :) >> +++ 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=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. I tried guix weather with this change, and things seemed fine. Is there a specific bit of Guix you're concerned about? --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmVkakBfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XcoJhAArMwV2vXM3qOOR01PaYfTHmQb/NcB3XiK VXiusYS9WB15qLYF8v3qxhXtvhy/4ZBmmTCe9l/adwjqGqoHAeBqSRHNODvCZG3+ KXEclNOe1/7zWFlIkzP3bjHBQr9qOHdEq2NLl+Btyzn/9c8WGYeR0SWCgY4rjDtX fUicq8czkuAURryhErg1wyDXgHdNwt4mez7sH7Tx3biBSC71PRmc/Cjbn5n3bhM9 cqJ8BWpel198VsDAJpCF+s6PvmfHRMCvuFie0IVl6O3wuvGkMoO6VofMg8i0mlsE sBh97Cio+ShZRhtqjYP6L50cNnQNwH3WT7QfhG0qMOPJJCje21MRckmyfWiot4pp BQmYVmyBxzOesKsfWvexuCeQN7BF9XAkFgf+vu2xfCmjxTNdCrqB/6YswVqa4/Z2 oIB0hiWEMhQxC0bCDU2dIExi1LkrXlAWQJPxPYxwaz3VnT3fUy7zHW5Ql2iXFd/r 2Sr8Iy7MvGVpmwyaQA3LgLcDji/h1vxQpzqniZDFaqFPMgdSEcxCG3wKGzZIsPAJ MtyA5FPYxPHt042bWrGMNdyiVMpBpSZvzfgexCpJi96jikfD9tkWOyEjxgUnk7Jo 4QA03acFYUPxFkIiey6mJOFvzVzeTogFMqe6sV7/Bvz2fWv/dSczx8MbWNaEeoRP qEmCKTgUzvE= =iswm -----END PGP SIGNATURE----- --=-=-=--