From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id wLGRJG+o+GQlSwEAG6o9tA:P1 (envelope-from ) for ; Wed, 06 Sep 2023 18:27:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id wLGRJG+o+GQlSwEAG6o9tA (envelope-from ) for ; Wed, 06 Sep 2023 18:27:27 +0200 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 3608D35A20 for ; Wed, 6 Sep 2023 18:27:27 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=NImgWX8s; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1694017647; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=9zptltsTTkXLwFc/tMyTfKfrxto0K8jnUb/771Bd28I=; b=NbK9EyhwWBKefnecXONy/HMuYOSQY6l/ahOr0RIl3109XoPdxiXosGBtUBEI+IxxWT3Zwy GEJN9GaXf+bC5lVY5/+98ueI0IsVF//8QPUWZ5m83HIZgilyVZzMHqcVB5iZohDgmt0Adn bI/5wKPn5ho/kZES3sWU0qc1CpMBsW2GvzY5yCgIdfXUeg23EJM2yuv5oFuqLV041kaIp7 c/fhuu3noozXFUtE1LaPWIOeYghDEtrk2yT2V+hZls69y4pYQ8ndeIyo84/QV3p7f6frXy O2vTRyxMrhgOb7bRXdWyUOSewrc/zDCBMbdOum2k9Y9KbwQ9Wk5Zf6YB9zsv8w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1694017647; a=rsa-sha256; cv=none; b=N3RE20+BWvQMsqkFl+E4crX2NgsUTfuUAuVrGuC85Yv01yClkrcCBX4PpPdWUXCV4pvSEU 6YKdHIKoANskDlIkmLXo3HAHqgLkL/KjBIuxyp/bh0lm0eHwoT7/ZXSbOSw8dIDeNvvNwD NunZ0wiX3qym9JHJzRXHtAxmsVh6wJj+owCECf747qG01z2QCmzBnSxHRFYPzyvFZVTzqA QjS5Z4wWR1D27IvoedGMVaamyRNVNhSOCbPRpP2RgUpsm+roYwnR+IH4g9zgOJgWxG1qe3 YfYIaRd2s79hnPcKZhTHnWXmkGyUTESdBBYpZfPV8h9gv1fXXWnKy4i9Ko6iCA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=NImgWX8s; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdvMs-0003Jb-La; Wed, 06 Sep 2023 12:27:02 -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 1qdvMr-0003JM-1b for bug-guix@gnu.org; Wed, 06 Sep 2023 12:27:01 -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 1qdvMq-0001vv-OX for bug-guix@gnu.org; Wed, 06 Sep 2023 12:27:00 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qdvMr-0006d3-RM for bug-guix@gnu.org; Wed, 06 Sep 2023 12:27:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#65787: time-machine is doing too much network requests Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 06 Sep 2023 16:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 65787 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 65787@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.169401759925449 (code B ref -1); Wed, 06 Sep 2023 16:27:01 +0000 Received: (at submit) by debbugs.gnu.org; 6 Sep 2023 16:26:39 +0000 Received: from localhost ([127.0.0.1]:37238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdvMV-0006cO-4P for submit@debbugs.gnu.org; Wed, 06 Sep 2023 12:26:39 -0400 Received: from lists.gnu.org ([2001:470:142::17]:39894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdvMR-0006c9-4U for submit@debbugs.gnu.org; Wed, 06 Sep 2023 12:26:38 -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 1qdvMK-0003GL-EF for bug-guix@gnu.org; Wed, 06 Sep 2023 12:26:28 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qdvMH-0001mg-TD for bug-guix@gnu.org; Wed, 06 Sep 2023 12:26:28 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-401d61e9fecso136975e9.0 for ; Wed, 06 Sep 2023 09:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694017584; x=1694622384; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=9zptltsTTkXLwFc/tMyTfKfrxto0K8jnUb/771Bd28I=; b=NImgWX8s11Wtvl6uvhiB+DJdg9LbqQ5Ug6z3OS4+i3xif+xGhGb3MDHNUjhWcG+d+U jj4eHOxb5hxV3NCVD6rcH+Nk2rp6P0q0zC6Xw/ZAd3sKJpbdOB15K/XIwYUTymtqK8FF uk2wjiJpYZOAiP4KzJZ5ZJqHKm5//80YWdIv4bF0GZx6mWdCG7UTBAFCbPFs4uirj7E9 oNlQxeTJH/BKuNRsyFwp2UkEmAasCPb+3kqY8KXJ81bCIwJQ+/No4pLudpRYHLmEStd/ nCO/D72WsUDLGi/s+N23ANeNp13RPrCYEHG90elI2WxBNirtFw8NwJV6qgZTganGmt1i 1Ctg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694017584; x=1694622384; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9zptltsTTkXLwFc/tMyTfKfrxto0K8jnUb/771Bd28I=; b=NibgwUkhd8wlhmOk0irV0N+KPlI6qz0xbMCnuUmzbTSoG6qBzlAOzZxBxKGk5SOHNx jOk2Wp/meFpDKiM1tDLKj6dFvY0277OkEyshw5SyqJGJv1iup439gTSERAvxjy/HSvgP KyjrKXQE7IwNS39J1VjadtKi9UGLCLFc8q+YTXlrZ1oiAzUODUS/6Hnxn9oSXkCYlhEZ 6T063OZfrkqGoFOca8nM67fKvbYUCuO8RZsTSILcqDyb0ufr1eo1TvluTtQu+6h6e22u KeD/dHqBU8R6rNdKUpDjj2bPc3t4/OqTN9fD6D+qw3TjDdff2kjKs8XtHd3LvkyUNWJQ rgZg== X-Gm-Message-State: AOJu0Yx0S3io0h6sqKwOieXFQlAC3c+zHh8mhOXmpfQHhJk/bh/vBdHt wDupMRvMHgaiIX3e/wradT9FdBgpPvs= X-Google-Smtp-Source: AGHT+IEtsAIihGaYSh+4jpPJc06NDoBNGJjpLaZbohaECNLJJvm2nxPqEqWn/EM2F9RIK2L5C/x+uA== X-Received: by 2002:adf:d08d:0:b0:317:3d36:b2c1 with SMTP id y13-20020adfd08d000000b003173d36b2c1mr12102068wrh.7.1694017583833; Wed, 06 Sep 2023 09:26:23 -0700 (PDT) Received: from pfiuh07 ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id x9-20020adfdd89000000b003196b1bb528sm21052494wrl.64.2023.09.06.09.26.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Sep 2023 09:26:23 -0700 (PDT) From: Simon Tournier Date: Wed, 06 Sep 2023 18:26:18 +0200 Message-ID: <87wmx3mfo5.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=zimon.toutoune@gmail.com; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -5.13 X-Spam-Score: -5.13 X-Migadu-Queue-Id: 3608D35A20 X-TUID: DgQIvZuIKD43 Hi, Well, I am in a quest to make Guix more robust for the worst-case scenario: Savannah is unreachable (as well as other servers). For context, it matters when using Guix for reproducing scientific production. An example of such worst-case, see [1]. Well, this quote: The first annoyance is that guix time-machine needs an access to the server git.savannah.gnu.org, although the Git repository is already cloned and already contains the required commit.=20 is almost tackled by #65352; at least tracked. :-) Investigating that, I am noticed that the current design is suboptimal, IMHO. I am reporting here and I hope to improve the situation by reducing the number of network requests. It matters in worst-case scenario of scientific production. And it also matters for people with poor or unstable network link. Sorry if the report is hard to follow, I did my best for being clear. To keep the discussion simple, I only consider the Git reference specification =E2=80=99branch=E2=80=99 and =E2=80=99tag-or-commit=E2=80=99.= These Git reference specification that various internal procedures are using is poorly documented. See the docstring of the procedure =E2=80=99update-cached-chec= kout=E2=80=99 from (guix git) for an idea or the implementation of =E2=80=99resolve-refer= ence=E2=80=99 for the complete list. Let consider only the Git reference specifications: (branch . "string") (tag-or-commit . "string") because that are what =E2=80=9Cguix time-machine=E2=80=9D sets from the CLI= or reads from channels.scm files, IIUC. The command =E2=80=9Cguix time-machine=E2=80=9D starts to call =E2=80=99cac= hed-channel-instance=E2=80=99 passing as argument the procedure =E2=80=99validate-guix-channel=E2=80=99. This procedure =E2=80=99cached-channel-instance=E2=80=99 starts by collecti= ng all the commits for each channel. It maps the channels list using the procedure =E2=80=99channel-full-commit=E2=80=99. And that procedure calls =E2=80=99update-cached-checkout. (1) Then, =E2=80=99cached-channel-instance=E2=80=99 calls =E2=80=99validate-gui= x-channel=E2=80=99. And this procedure also calls =E2=80=99update-cached-checkout=E2=80=99. (2) Then, =E2=80=99cached-channel-instance=E2=80=99 calls =E2=80=99latest-chann= el-instances=E2=80=99 which calls =E2=80=99latest-channel-instance=E2=80=99. And guess what, this proc= edure also calls =E2=80=99update-cached-checkout=E2=80=99. (3) Ok, let give a look at =E2=80=99update-cached-checkout=E2=80=99. This procedure =E2=80=99update-cached-checkout=E2=80=99 first looks if the = Git reference specification is already in the cached Git checkout using the procedure =E2=80=99reference-available?=E2=80=99. Consider that the Git reference specification is (branch . "some"), then =E2=80=99reference-available?=E2=80=99 returns #false, so it triggers =E2= =80=99remote-fetch=E2=80=99 from Guile-Git. If I read correctly, this generates network traffic and Savannah needs to be reachable. (I) Hum, I am not convinced someone is following. Who knows? :-) Let continue. =E2=80=99update-cached-checkout=E2=80=99 starts to check som= e commit relation and friends. There is an if-branch calling then =E2=80=99switch-to-ref=E2=80=99 else =E2=80=99resolve-reference=E2=80=99. = Under the hood, the procedure =E2=80=99switch-to-ref=E2=80=99 is calling =E2=80=99resolve-reference=E2=80= =99. For the case (branch . "some"), this =E2=80=99resolve-reference=E2=80=99 pr= ocedure calls =E2=80=99branch-lookup=E2=80=99 from Guile-Git. If I read correctly, this = generates network traffic because of BRANCH-REMOTE and Savannah needs to be reachable. (II) Summary: ( (1) + (2) + (3) ) * ( (I) + (II) ) =3D 6. If I am correct and if I am not missing something, the current design requires 6 network traffic with Savannah and most of this traffic is useless because it had already be done, somehow. Well, (branch . "some") is the worst case, IMHO. And the short commit ID (tag-or-commit . "1234abc") or the tag (tag-or-commit . "v1.4.0") too. Applying my proposal from #65352 (DRAFT v2), it removes some useless =E2=80=99remote-fetch=E2=80=99 calls. Well, let me know if this diagnostic is correct. To be continued=E2=80=A6 Cheers, simon 1: https://simon.tournier.info/posts/2023-06-23-hackathon-repro.html