From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id YG7kFQVrQmZUywAAe85BDQ:P1 (envelope-from ) for ; Mon, 13 May 2024 21:33:25 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id YG7kFQVrQmZUywAAe85BDQ (envelope-from ) for ; Mon, 13 May 2024 21:33:25 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=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"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1715628805; 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-to: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=HDhzJI9T0HIjqmiSdpGVRRKUfdsFMSClv72L7r5sNzs=; b=H5/GcZmw8F9gjPIJ5I2Wy5uj4Gvfkcfj5dt3G/Xr5hJrBPkHXlHLaaSDrfkaKQyef+y5rR 0lQllo7oImoc/9Q+2UqWCLgnW0StUpRabqCAev5FkAYxelTcwS9qzxhX8WPUPowgG6wef4 npUwrWWO+ZE+47moyy7M6uJYFVi/BBVo6dd4+lrcrsByre48lcG8uEguUhVGpISZUnpyTI qkOZgkO11LM1Txgy3ssX3XnCUAM9j2pBnzvyiPn2R2WMQfVOwUxXTsSdDlYtHJ13vucuQj jSrVPHnY8BNjsitC4OMVI76HvgvEEa4lcGM5fn8xPFFwaVl67DnWJAsO66FHHQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=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"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1715628805; a=rsa-sha256; cv=none; b=QP8hV49uyQZhFvuxyEAUcscAYqqIr4Bwin4SKQoZLN9l90muuw25X6iH+UsvsrcmQ0Xxfh yg/llUwryY3gyHorOp2/0ROJ8CiNv6to09s/b60qoIlb/3IqGd38OHZW3nawnPGC9jNwMR maU3z6q2OMwx2TGqXSC9HCyfzK90VU5YvF0nTKrpmj0e5NBRyMg4pQilyUb5NqDYkAcwhv 8wc4vfs3svqj7SwwBCRmaMpR8+2fKp7uT1/BytCmi1qGaJqsqhTkcp+rosGhgf0ivBXjL6 IvE2lcyOhNxHpiJV7KlOlGqkes+Gp3Gs9rCeFO9FMLcBX8YQXp4BH5HY1wPzMg== 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 15B426B1E4 for ; Mon, 13 May 2024 21:33:25 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6bQ1-0004zy-Li; Mon, 13 May 2024 15:33: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 1s6bPy-0004x0-4Y for guix-patches@gnu.org; Mon, 13 May 2024 15:33:03 -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 1s6bPx-0000o2-Sp for guix-patches@gnu.org; Mon, 13 May 2024 15:33:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s6bPy-0008Kn-F6 for guix-patches@gnu.org; Mon, 13 May 2024 15:33:02 -0400 Subject: bug#67245: [PATCH v2] store: Add with-store/non-blocking. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Mon, 13 May 2024 19:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 67245 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 67245-done@debbugs.gnu.org Mail-Followup-To: 67245@debbugs.gnu.org, mail@cbaines.net, mail@cbaines.net Received: via spool by 67245-done@debbugs.gnu.org id=D67245.171562874432018 (code D ref 67245); Mon, 13 May 2024 19:33:02 +0000 Received: (at 67245-done) by debbugs.gnu.org; 13 May 2024 19:32:24 +0000 Received: from localhost ([127.0.0.1]:34415 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6bPM-0008KM-EI for submit@debbugs.gnu.org; Mon, 13 May 2024 15:32:24 -0400 Received: from mira.cbaines.net ([212.71.252.8]:43498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6bPK-0008KE-Es for 67245-done@debbugs.gnu.org; Mon, 13 May 2024 15:32:23 -0400 Received: from localhost (unknown [45.67.83.168]) by mira.cbaines.net (Postfix) with ESMTPSA id 156E827BBE2; Mon, 13 May 2024 20:32:20 +0100 (BST) Received: from felis (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 17fd9072; Mon, 13 May 2024 19:32:18 +0000 (UTC) From: Christopher Baines In-Reply-To: <87seylankt.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 13 May 2024 14:44:18 +0200") References: <460cdfa67b473ea2f1593668b2d9d0fd159378d0.1700244314.git.mail@cbaines.net> <87seylankt.fsf@gnu.org> User-Agent: mu4e 1.12.2; emacs 29.3 Date: Mon, 13 May 2024 20:32:16 +0100 Message-ID: <878r0d33un.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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -8.47 X-Spam-Score: -8.47 X-Migadu-Queue-Id: 15B426B1E4 X-Migadu-Scanner: mx13.migadu.com X-TUID: kbJhGCo6VDBY --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Hi, > > Christopher Baines skribis: > >> For some applications, it's important to establish a non-blocking connec= tion >> rather than just making the socket non-blocking after the connection is >> established. This is because there is 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. >> >> This commit adds a new with-store variant to avoid changing the behaviou= r of >> with-store/open-connection to ensure that this change can't break anythi= ng >> that depends on the blocking nature of the socket. >> >> * guix/store.scm (open-unix-domain-socket, open-inet-socket): Take >> #:non-blocking? and use SOCK_NONBLOCK when calling socket if appropriat= e. >> (connect-to-daemon, open-connection, call-with-store): Take #:non-blocki= ng? >> and pass it on. >> (with-store/non-blocking): New syntax rule. >> >> Change-Id: I8225762b78448bc1f7b698c8de5d736e13f577bf > > [...] > >> +(define* (open-unix-domain-socket file #:key non-blocking?) >> "Connect to the Unix-domain socket at FILE and return it. Raise a >> -'&store-connection-error' upon error." >> +'&store-connection-error' upon error. If NON-BLOCKING?, make the socket >> +non-blocking." >> (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))) > > Make sure SOCK_NONBLOCK is added only when =E2=80=98non-blocking?=E2=80= =99 is true. Ah, yep, I've fixed this now. >> +(define-syntax-rule (with-store/non-blocking store exp ...) >> + "Bind STORE to an non-blocking open connection to the store and evalu= ate >> +EXPs; automatically close the store when the dynamic extent of EXP is l= eft." >> + (call-with-store (lambda (store) exp ...) #:non-blocking? #t)) > > I think we=E2=80=99ll need an entry in =E2=80=98.dir-locals.el=E2=80=99 a= nd one in (guix > read-print) for proper formatting. I've added an entry in to .dir-locals.el, but unless I've missed something, (guix read-print) doesn't handle with-store so maybe we need to add with-store and with-store/non-blocking. > OK for me with these changes! Great, I've pushed to 3db1a8341c815af3673c367518fbb193f5592864 and I can follow up with the (guix read-print) changes and updating the guix package later. Thanks, Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmZCasBfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XdVjxAAnKw2ImrI99fhS9eJGeSIjqF3/gudibar vJ4DqtDCIYpsvfOMTlDpO/+HLRRAZSZDh5YNQfQmcW+T+KiEMCsglTZBI3j3f40V DZh7MLu4hannLtuFnnu78Ck3lrE7ro7tv7t8VoG5Wfp5ceSmjHJ/LUqdkPt4R22k /ztJURBepuS7ENoyt5+jX/5C/cLjnUQYXsl6W6Z5qihOhwpqLSaFGbmj8OqNGJ4L ULUoLjnRsDplNCuRf1afFYMHHhNNlWj3y1CdrtUwHEIxuTtptclknv/MSl/JLsCf 2qQsXQ5o71mJZ5SIOU9wKfUvBD9SBqumsZD1xLnZhYikngqzjttxY8gA6ca4FaVh Klk/mXukC4RRZt9CBcYS+whiURCVzueB+PNUR3ptVZ9aFQ2ZeiP3AWQ8U/3ubg6C 6RuiRvldo7eBWXQRlfA/vix7SdnaG5KZfTBTqzQnBNpQl4z6lPDCcNr3vQcM8p96 eohG784Hn1QJo8XqWo0PkSkoRTGmCifaHFSsunUGuAw/Vm2tAwV21ku+8xF1lJ/M zyRELFz1RB4CK+4YCOf4sJ0JJcC7curHuwnY+XCJIxctZ4n65VJzia+T6TbxgHmN LnszLl8+GFLkssIIWSmTOraaHmc9JR269V+v8IVkgkD/zTrHqPFKTCVMzBSh09RK yx5g3Gr+l0M= =41fg -----END PGP SIGNATURE----- --=-=-=--