From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SBm1BwoTbGKZSwAAbAwnHQ (envelope-from ) for ; Fri, 29 Apr 2022 18:32:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id mLBpBwoTbGKAdgAA9RJhRA (envelope-from ) for ; Fri, 29 Apr 2022 18:32:10 +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 9BE862DECA for ; Fri, 29 Apr 2022 18:32:09 +0200 (CEST) Received: from localhost ([::1]:33174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nkTXM-0001QS-DZ for larch@yhetil.org; Fri, 29 Apr 2022 12:32:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkTMc-0005dL-Qy for guix-patches@gnu.org; Fri, 29 Apr 2022 12:21:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33070) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nkTMc-0007Dd-Hj for guix-patches@gnu.org; Fri, 29 Apr 2022 12:21:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nkTMc-00053q-Au for guix-patches@gnu.org; Fri, 29 Apr 2022 12:21:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54723] [PATCH] Check URI when verifying narinfo validity. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 29 Apr 2022 16:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54723 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Guillaume Le Vaillant Cc: Mathieu Othacehe , 54723@debbugs.gnu.org Received: via spool by 54723-submit@debbugs.gnu.org id=B54723.165124922519372 (code B ref 54723); Fri, 29 Apr 2022 16:21:02 +0000 Received: (at 54723) by debbugs.gnu.org; 29 Apr 2022 16:20:25 +0000 Received: from localhost ([127.0.0.1]:55196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nkTM0-00052N-Iv for submit@debbugs.gnu.org; Fri, 29 Apr 2022 12:20:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35192) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nkTLy-00052B-Vo for 54723@debbugs.gnu.org; Fri, 29 Apr 2022 12:20:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:52660) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkTLt-00079H-O3; Fri, 29 Apr 2022 12:20:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=3HrmcP5sP67IY8JlUW3lBkg1ObuBN4vGpgYAo73YpqE=; b=gmDDYmpfeZVOjVAat3Vo KSQsV1AOYEC77VtdLYrm7ApLD42X7z4VtAEQsy36wzHQk9CfgXt7PqTwUtPmj40JQBW8eIqjwt+CO IYbPvILubrsaSALGQk0D3vdbq2W+purNgbhfhGrvy4NfN5twkaY70ftdovbMJv+PGdVdswQXsntdJ qBoXR+V/czd9+ZeHhVhhIP1PnFRxpAtg389m1oL9WL4A/XBeE28qXU5yfO9DdCJSUCj7fZNe0L6Ui Co67fzy9X3GwbAms9J9XIrynHXbZ7+/K4PM/CyUb52o/zZSO1ajJFIhf3J+N5ACx1T0MrvkgQHRWR G0h1QpQskLmKyA==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=48982 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkTLt-0000DA-AU; Fri, 29 Apr 2022 12:20:17 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87a6czbzvh.fsf@kitej> <877d83lapv.fsf@gnu.org> <875ynnbe65.fsf@kitej> <87pmlq6lqx.fsf_-_@gnu.org> <877d7ydjwk.fsf@kitej> <87wnfv90cl.fsf@kitej> <871qy2g2v3.fsf@gnu.org> <87o816wt36.fsf@kitej> <87sfqfc0fq.fsf@kitej> <87bkwyxjtp.fsf@gnu.org> <87v8v3ddz5.fsf@kitej> Date: Fri, 29 Apr 2022 18:20:14 +0200 In-Reply-To: <87v8v3ddz5.fsf@kitej> (Guillaume Le Vaillant's message of "Wed, 20 Apr 2022 14:10:43 +0000") Message-ID: <87y1zn6ev5.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-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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651249929; 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: 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:dkim-signature; bh=3HrmcP5sP67IY8JlUW3lBkg1ObuBN4vGpgYAo73YpqE=; b=hDj5ehni1j55a1IBm20PrQwI8LsbNzqzaDUq1YTeYNMAEMr75p/dYyNpKY+e6t9xRJ7GDa RI5d0sI1wcLX+DVg0ouu/A8KVZOOVwP4aCh06G84njXqizEgq/e/63dM+DLb5R7F3BstBz a08g7A92zjOad/CKfLtQZ96+jpL578qPLVlI51U3adfiL8CDvYalL7xn3SKXzLOVzegwbK X/wkzxtdY+MTO0BZ8RUSWMhX9DmHlCYUV1FCrih1dY5CMvC+hcGzhP7mfOPY5CCb9w5FyB /DNSRDZ0IrX2oQhi5txXpoXv3TZBVI5eQPrH9nZeM3r/VD0d5IoRYbUBQQdkSQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651249929; a=rsa-sha256; cv=none; b=Qj/Rbigo8o8jWS1QQ5Gpj1342nO/hcnb3c8xeAYTZYJ9zQDodhbs7H/PcBz0b/EUh3qtbM IWIj0gTfMHLUwV5HpjuGEfec4bos6nAVunpHUUCy+/DUs2XxjpF+JDQhzANbzKCbn4qjdo 26mbdRSiEWrLyok/W4kkHb5jnfXanpmyBwGBgvhQFvFmHnGt7aVIHy51X82KbuX1jo72Xw 6QkzI0mMevAi/sCo4MPzT1ImN13LwHGJNPvOpg3P228iN/LyNzATjddjVYyQM00wIf6AFN Ub/n9uTWc6/C6OzsnB8ZMlmyrEkClSzHafSn3i8Y+fy3CLIp4mN8bsPpuRaGqQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=gmDDYmpf; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Spam-Score: -3.90 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=gmDDYmpf; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Queue-Id: 9BE862DECA X-Spam-Score: -3.90 X-Migadu-Scanner: scn1.migadu.com X-TUID: c4GRidyyde6E Hi, (+Cc: Mathieu.) Guillaume Le Vaillant skribis: > With master at 101edbe63a887678722bc26cd85a7b7f5637428f, I reproduce the > issue very often when trying to upgrade a profile with around 400 > packages. The logs of the publish server show hundreds of narinfo > requests and tens of "broken pipe" errors. > > With an additional commit reverting > f743f2046be2c5a338ab871ae8666d8f6de7440b, I can't reproduce the issue > anymore. The logs still show hundreds of narinfo requests, but no > errors. For the record, a simple way to reproduce it is to start =E2=80=98guix publ= ish=E2=80=99: sudo -E ./pre-inst-env guix publish -u nobody -p 9999 and to spawn =E2=80=98guix weather=E2=80=99, for example with: guix weather $(guix package -I. -p ~/.guix-home/profile |cut -f1) \ --substitute-urls=3Dhttp://localhost:9999 which crashes with the dreaded backtrace: --8<---------------cut here---------------start------------->8--- Backtrace: 11 (primitive-load "/home/ludo/.config/guix/current/bin/guix") In guix/ui.scm: 2230:7 10 (run-guix . _) 2193:10 9 (run-guix-command _ . _) In ice-9/boot-9.scm: 1752:10 8 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) In guix/scripts/weather.scm: 595:9 7 (_) In guix/build/utils.scm: 677:23 6 (every* # _) In guix/scripts/weather.scm: 597:21 5 (_ "http://localhost:9999") 120:17 4 (report-server-coverage _ ("/gnu/store/428bzp9325mfapyr4ywzwsz= 4ic7ssx2b-shepherd-0.9.0" "/gnu/store/sll9nfmqk8lkrraqbkyp3y=E2=80=A6" =E2= =80=A6) =E2=80=A6) In unknown file: 3 (_ # # . #w()) In guix/substitutes.scm: 322:31 2 (lookup-narinfos "http://localhost:9999" _ #:open-connection _= #:make-progress-reporter _) 245:26 1 (fetch-narinfos _ _ #:open-connection _ #:make-progress-report= er _) In ice-9/boot-9.scm: 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: Wrong type (expecting exact integer): #f --8<---------------cut here---------------end--------------->8--- I looked more closely at f743f2046be2c5a338ab871ae8666d8f6de7440b and I think it had a logical flaw: if you pipeline 100 GET requests, then, with this commit, =E2=80=98guix publish=E2=80=99 would spawn 100 threads th= at would all reply concurrently (more or less). This is clearly wrong: replies should be sent sequentially. So in commit c1719a0adf3fa7611b56ca4d75b3ac8cf5c9c8ac I went ahead and reverted it that commit. I also added a test that reproduces the issue above. Now, commit f743f2046be2c5a338ab871ae8666d8f6de7440b was itself an attempt to fix a bug whereby =E2=80=98narinfo-string=E2=80=99 would take to= o long, thereby preventing =E2=80=98guix publish=E2=80=99 from accepting connection= s (since it=E2=80=99s single-threaded). I think the only reasonable way to fix it is by using Fibers to make =E2=80=98guix publish=E2=80=99 concurrent (using a fiberized server like in= Cuirass). We should do that at some point. That=E2=80=99ll also allow us to remove s= ome of the hacks we=E2=80=99ve accumulated. Now, the only way =E2=80=98narinfo-string=E2=80=99 can take too long these = days is (I think) if the store GC lock is held (we should check that hypothesis, but I believe that if the GC lock is held, then the =E2=80=98query-path-inf= o=E2=80=99 RPC made from =E2=80=98narinfo-string=E2=80=99 might block until the lock i= s released). The GC lock is no longer held for hours on berlin, so there=E2=80=99s less pressure to address that. To summarize: I think =E2=80=98guix publish=E2=80=99 is okay as-is but we s= hould fiberize it sometime. Thoughts? Ludo=E2=80=99.