From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id gFI8LWhTTl+ARgAA0tVLHw (envelope-from ) for ; Tue, 01 Sep 2020 13:58:00 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id iAEHKWhTTl8RTAAAbx9fmQ (envelope-from ) for ; Tue, 01 Sep 2020 13:58:00 +0000 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 58FA0940917 for ; Tue, 1 Sep 2020 13:58:00 +0000 (UTC) Received: from localhost ([::1]:48764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kD6nP-0005zS-7E for larch@yhetil.org; Tue, 01 Sep 2020 09:57:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kD6mU-00047j-Ag for bug-guix@gnu.org; Tue, 01 Sep 2020 09:57:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45059) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kD6mT-0001pa-Vb for bug-guix@gnu.org; Tue, 01 Sep 2020 09:57:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kD6mT-0002GD-VK; Tue, 01 Sep 2020 09:57:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#42740: Segfault in libssh during =?UTF-8?Q?=E2=80=98guix_?= =?UTF-8?Q?copy=E2=80=99?= Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 01 Sep 2020 13:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42740 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 42740-submit@debbugs.gnu.org id=B42740.15989686148675 (code B ref 42740); Tue, 01 Sep 2020 13:57:01 +0000 Received: (at 42740) by debbugs.gnu.org; 1 Sep 2020 13:56:54 +0000 Received: from localhost ([127.0.0.1]:56605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kD6mM-0002Fr-B0 for submit@debbugs.gnu.org; Tue, 01 Sep 2020 09:56:54 -0400 Received: from mail-qt1-f179.google.com ([209.85.160.179]:37684) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kD6mK-0002Ff-GE for 42740@debbugs.gnu.org; Tue, 01 Sep 2020 09:56:53 -0400 Received: by mail-qt1-f179.google.com with SMTP id d27so910878qtg.4 for <42740@debbugs.gnu.org>; Tue, 01 Sep 2020 06:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=ULiPDACceQrxyJtAzfnptTmjjtrmoCFgErQGFnhgDBI=; b=hvx4Fk4OW58KvajLaTNtO74HC7UN1Hx7edhlPO89Hc51HCjri0stirSoywtkHZbD77 ISu3uUDCzVurk087Uat4LqKRTHokWd6PXLyWsIsoVbf7pKUuUUq8Szzpiaq5Xe2AAa1x DAr20BZKVCh+GY1O12WZ8baof+8xR3xP4yHP1MVdT9VGnY1/Hv+OIXTe2nt2u2LodTW2 mPuFHH6PnmWreBP5s4+ZvICR818+7JSe6GI7bl3KZndFNwrdK1MqJQF0ImN5KdgIe9Gz FbIrxC4U4xkxfFon4LaUGOwYLkPucm9PbY9gwptBT8FdoQ3tOpli0Q/WwweRWnn4Q3bp lo7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=ULiPDACceQrxyJtAzfnptTmjjtrmoCFgErQGFnhgDBI=; b=fObth/cMnEqG2IO6rBpNg5st+Ioyiq6jw6jZHF8QbbyiXzgt+sGkD9z0HAAt+HjUyl Gyo38ZbqJnN7MNSsIKuL9ifei0oTwN2XRu1YXpcGkka94BiiBwKcC7Jjm3RN7s90dE5B RUadagaCEuXmrginAuwXVCDzFPQWW13FZ3lSbKMKnKln3OTxFVytUeEs+KpBQ2QfpAVv rHgsvaN+Q/YEsFLmeD0j4oev3jB1gbPnpH1EgWId65hcYT5UlWgcsNbn/X7v8B09i3NG j6VSTNEw5Yc662/rbJ3q/KP8dXVBNo8z6biGKehawzbfWClu17qT82ji+0u0fOJxP2KI vPGQ== X-Gm-Message-State: AOAM533sWCyAs+tjOSuhVgtx4jX8lWKcjKHprkpSX5PfWVZrkcdsWjMc Iyd3EPuCate19Jn99+NiDLEoa/Zbem+BYQ== X-Google-Smtp-Source: ABdhPJwXVK1G8J9sLqaZSEqA4pw+uAsVnMBZvQ0j8wRJZe425zGbZ/LHQfhIZ5BccZFofhgxzbfHJQ== X-Received: by 2002:ac8:100c:: with SMTP id z12mr1880564qti.81.1598968606535; Tue, 01 Sep 2020 06:56:46 -0700 (PDT) Received: from hurd (dsl-10-133-254.b2b2c.ca. [72.10.133.254]) by smtp.gmail.com with ESMTPSA id g18sm1413398qtu.69.2020.09.01.06.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 06:56:45 -0700 (PDT) From: Maxim Cournoyer References: <871rkin6zi.fsf@inria.fr> <874kollgst.fsf@gnu.org> <87h7sljzgn.fsf@gnu.org> Date: Tue, 01 Sep 2020 09:56:56 -0400 In-Reply-To: <87h7sljzgn.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sat, 29 Aug 2020 16:31:20 +0200") Message-ID: <87eenlzjkn.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Artyom Poptsov , 42740@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=hvx4Fk4O; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: r7bJrlP5p7c7 Hi Ludovic and Artyom, Ludovic Court=C3=A8s writes: > Ludovic Court=C3=A8s skribis: > >> So we have the finalization thread closing a channel of session >> 0x12a4b20 (which causes a write on the channel), and the main thread >> writing to a channel of that same session. This is exactly what I >> described at : >> >> AIUI, that means there=E2=80=99s one output compression buffer per ses= sion, >> and it=E2=80=99s not thread-safe (in Guile 2.2 finalizers are called f= rom a >> separate thread.) >> >> I think the fix, in Guile-SSH, is to associate each libssh object >> (session, channel, etc.) with a mutex, and to protect all uses of the >> libssh object by that mutex. >> >> Artyom, WDYT? Do you think you could take a look into that? >> >> In the meantime, I=E2=80=99ll look for the origin of the channel port th= at=E2=80=99s not >> explicitly closed and see if we can work around it. > > I=E2=80=99ve pushed this change on our side to explicitly close channels = and > sessions: > > https://git.savannah.gnu.org/cgit/guix.git/commit/?id=3D61fe9ced7da7eef= ceb931af0cb7363b721f5bdd6 > > This workaround is similar to that of 2017: > > https://git.savannah.gnu.org/cgit/guix.git/commit/?id=3D8e469b67f95cfe5= b95405b503b8ee315fdf8ce66 > > It=E2=80=99s really just a workaround so I think we should fix the core i= ssue in > Guile-SSH (or libssh) so it doesn=E2=80=99t pop up again next month=E2=80= =94it=E2=80=99s hard to > ensure code that opens a channel explicitly closes it. Do you think the issue lies in guile-ssh or in libssh itself? Sorry for not having caught these problems earlier; it seemed to work reliably when I last tested it. > Anyway, I would welcome tests using =E2=80=98guix copy=E2=80=99, =E2=80= =98guix deploy=E2=80=99, and > offloading. (For offloading, make sure to run the daemon from your > build tree.) While attempting to use offload on the core-updates branch, I encountered stalls and file errors, but with your patch it seems to work reliable (it's been offloading builds for the last 15 minutes or so without interruption). So your workaround fixes seem to work as intended. I also agree that it'd be much nicer and future proof if we could fix the root issue. Thanks! Maxim