From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id ANbVHBiFD2IPHQEAgWs5BA (envelope-from ) for ; Fri, 18 Feb 2022 12:38:00 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 81KNFRiFD2Jn5QAAG6o9tA (envelope-from ) for ; Fri, 18 Feb 2022 12:38:00 +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 EE4FB20DAC for ; Fri, 18 Feb 2022 12:37:59 +0100 (CET) Received: from localhost ([::1]:43890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nL1aI-00029Y-M7 for larch@yhetil.org; Fri, 18 Feb 2022 06:37:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nL1Ta-0004aZ-Kr for bug-guix@gnu.org; Fri, 18 Feb 2022 06:31:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59658) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nL1Ta-0005YH-AA for bug-guix@gnu.org; Fri, 18 Feb 2022 06:31:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nL1Ta-0001IZ-5p for bug-guix@gnu.org; Fri, 18 Feb 2022 06:31:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#48007: computing derivations through inferior takes twice as long Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 18 Feb 2022 11:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48007 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 48007@debbugs.gnu.org Received: via spool by 48007-submit@debbugs.gnu.org id=B48007.16451838474968 (code B ref 48007); Fri, 18 Feb 2022 11:31:02 +0000 Received: (at 48007) by debbugs.gnu.org; 18 Feb 2022 11:30:47 +0000 Received: from localhost ([127.0.0.1]:53555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nL1TL-0001I4-2h for submit@debbugs.gnu.org; Fri, 18 Feb 2022 06:30:47 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:35040) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nL1TJ-0001Hp-N6 for 48007@debbugs.gnu.org; Fri, 18 Feb 2022 06:30:46 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id E4F1B3A7 for <48007@debbugs.gnu.org>; Fri, 18 Feb 2022 12:30:38 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FyvkSUgPuUz2 for <48007@debbugs.gnu.org>; Fri, 18 Feb 2022 12:30:37 +0100 (CET) Received: from ribbon (unknown [IPv6:2001:660:6102:320:e120:2c8f:8909:cdfe]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 2F9311A4 for <48007@debbugs.gnu.org>; Fri, 18 Feb 2022 12:30:37 +0100 (CET) From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87r18ufcft.fsf@gnu.org> <20220127084743.27130-1-ludo@gnu.org> <20220127084743.27130-2-ludo@gnu.org> Date: Fri, 18 Feb 2022 12:30:36 +0100 In-Reply-To: <20220127084743.27130-2-ludo@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Thu, 27 Jan 2022 09:47:41 +0100") Message-ID: <87k0dsjtsz.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: / X-Rspamd-Server: hera X-Rspamd-Queue-Id: E4F1B3A7 X-Spamd-Result: default: False [-0.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[48007@debbugs.gnu.org]; RCPT_COUNT_ONE(0.00)[1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1645184280; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: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=RDbUcWW/1QXxyHveku/K1rOMdEyvmfEbR5QWkzhUkL0=; b=ar/ddOngNMsH3KKLEpZJ2AGzXiFeeUj5sgn1PY4QJDcg4hjgxzxg+RfFPZbptb5W49Nzes BmwFDO7WLB2QyyeVR4Lb83RCZkeRgeUvhPgcn0YLH8TUhcXzOvV9GW8Y5rwLqkMwFXYNDM 7dPxmP4pIOb/V6UiRHX7aYod1gKnl/YMisvF07x6oSribYR9eOE+zNsjztJeNyZxncVd8m 1l+6yA9pqqI03VTTQGR0hWF4nqW+7UkEDVRsMMCGBpPNTyasIu1E7AqMS7Jp+JwZ0277w9 wngvDnriD/06vEbUPnNHmp3nIae/o2Dd3xoBZh+EB/Ox4jnAG72YNik0UVt6XQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645184280; a=rsa-sha256; cv=none; b=h8lfnxOfmPk6YTv4bKNSAMKmBiZqHNufhA5EqMPPr9/XBjyTQpfoaG3A69128aFD49Y8dH eHq/C+atjKghgOxhREIqZwNY8TGS+RlizmvaYZpLuoN8a9V6RwCByPOJoPlBXWi6zVIvO3 YV06bIyg5J3+Pa9ls9aQZ7+iSlQTWvUtVPrMxLuC516erbFWgu4I27e8vjbKzW5mfGkynq gg0/0S+3stqNTx/15YyxBFRqiXNItXBpZ/JNue0XIU3YvUxq8Cs1ccYRSDaVia+4lO1oex HCUh53nwOjmawcPLPQLAkc1csULdp5P8wpn1nTTfhWkTohLtqrNYKSyRvtkkHQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.63 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: EE4FB20DAC X-Spam-Score: -3.63 X-Migadu-Scanner: scn1.migadu.com X-TUID: KCy4aJk/a/Xl Hi, Ludovic Court=C3=A8s skribis: > Previously, each 'inferior-eval-with-store' would lead the inferior to > connect to the named socket the parent is listening to. With this > change, the connection is established once for all and reused > afterwards. > > * guix/inferior.scm ()[bridge-file-name]: Remove. > (open-bidirectional-pipe): New procedure. > (inferior-pipe): Use it instead of 'open-pipe*' and return two values. > (port->inferior): Adjust call to 'inferior'. > (open-inferior): Adjust to 'inferior-pipe' changes. > (close-inferior): Remove 'inferior-bridge-file-name' handling. > (open-store-bridge!): Switch back to 'call-with-temporary-directory'. > Define '%bridge-socket' in the inferior, connected to the caller. > (proxy): Change first argument to be an inferior. Add 'reponse-port' > and call to 'drain-input'. Pass 'reponse-port' to 'select' and use it > as a loop termination clause. > (inferior-eval-with-store): Remove 'socket' and 'connect' calls from the > inferior code, and use '%bridge-socket' instead. [...] > +(define (open-bidirectional-pipe command . args) > + "Open a bidirectional pipe to COMMAND invoked with ARGS and return it,= as a > +regular file port (socket). > + > +This is equivalent to (open-pipe* OPEN_BOTH ...) except that the result = is a > +regular file port that can be passed to 'select' ('open-pipe*' returns a > +custom binary port)." > + (match (socketpair AF_UNIX SOCK_STREAM 0) > + ((parent . child) > + (match (primitive-fork) I noticed that there=E2=80=99s at least one case where this is used from a multi-threaded program, and as we know, fork + threads don=E2=80=99t go well together: --8<---------------cut here---------------start------------->8--- $ make as-derivation [=E2=80=A6] @ build-succeeded /gnu/store/n5jfi8pn1aq1ykmnq75xhr8ba2m7161l-profile.drv - warning: call to primitive-fork while multiple threads are running; further behavior unspecified. See "Processes" in the manual, for more information. warning: call to primitive-fork while multiple threads are running; further behavior unspecified. See "Processes" in the manual, for more information. warning: call to primitive-fork while multiple threads are running; further behavior unspecified. See "Processes" in the manual, for more information. --8<---------------cut here---------------end--------------->8--- The threads are created in =E2=80=98build-aux/cuirass/evaluate.scm=E2=80=99. In practice it=E2=80=99s OK because the code above calls =E2=80=98exec=E2= =80=99 right away; still, it=E2=80=99s annoying. Ludo=E2=80=99.