From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id UHeCJHilY2OGSAEAbAwnHQ (envelope-from ) for ; Thu, 03 Nov 2022 12:26:48 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 8BuFI3ilY2MbJgAAG6o9tA (envelope-from ) for ; Thu, 03 Nov 2022 12:26:48 +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 4709C2D194 for ; Thu, 3 Nov 2022 12:26:48 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqYMI-0004oP-M0; Thu, 03 Nov 2022 07:26:06 -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 1oqYMF-0004nL-86 for bug-guix@gnu.org; Thu, 03 Nov 2022 07:26:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oqYME-0005IS-V9 for bug-guix@gnu.org; Thu, 03 Nov 2022 07:26:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oqYME-0006ca-R9 for bug-guix@gnu.org; Thu, 03 Nov 2022 07:26:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#58732: installer: finalizers & device destroy segfault Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 03 Nov 2022 11:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58732 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Mathieu Othacehe Cc: 58732@debbugs.gnu.org Received: via spool by 58732-submit@debbugs.gnu.org id=B58732.166747475225406 (code B ref 58732); Thu, 03 Nov 2022 11:26:02 +0000 Received: (at 58732) by debbugs.gnu.org; 3 Nov 2022 11:25:52 +0000 Received: from localhost ([127.0.0.1]:48240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqYM3-0006bi-NI for submit@debbugs.gnu.org; Thu, 03 Nov 2022 07:25:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqYM0-0006bR-Re for 58732@debbugs.gnu.org; Thu, 03 Nov 2022 07:25:49 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqYLv-0005GT-Kk for 58732@debbugs.gnu.org; Thu, 03 Nov 2022 07:25:43 -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=0SfYP3BJTluKXliI3Opozww99xgKhwnwUlJP3EgZUoc=; b=OA1l7H/ii8XK4Ou8eUNY 853PVF/0ul7hLMW/gb+nwSxv5wM31UbytniT0sQb5j/KRPitna7fFed5yxlKg0RakdkhxtXnucdtj 8MMprZf0mLImvhTH/W7Am9GzIiRhcG7p7JwYSDpZ5mLExAarHyAkzkClfsq1jLee5DW8L82rfJFCi 1ozXnAaB6I+w+x4snZ9GIJtstAV8B4yHDCsiKgc15QVoLaKBzkBivxiDzYRhq1K4aO7ORvpvLgcj5 DC22qXZ+AKWC9S9w8fnpEJa9fryubTMbMv+eZFseyJHtPcDaJXJV/ppi/uXFeBSDZ3ETfQEcqzEXY qJc2CzjaC4sQfg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqYLu-0005Ww-Iz; Thu, 03 Nov 2022 07:25:43 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87v8oa29ik.fsf@gnu.org> <871qqlwrpy.fsf@gnu.org> <87iljwuwf7.fsf@gnu.org> Date: Thu, 03 Nov 2022 12:25:39 +0100 In-Reply-To: <87iljwuwf7.fsf@gnu.org> (Mathieu Othacehe's message of "Thu, 03 Nov 2022 12:09:16 +0100") Message-ID: <871qqkth3g.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (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: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "bug-Guix" Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org 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=1667474808; 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=0SfYP3BJTluKXliI3Opozww99xgKhwnwUlJP3EgZUoc=; b=FLPEE97uxvd7dfqugEExRqcr4tn28+BUPvVmrvBVRRl3TVRiV0UmCCiTWZtztyqwe1HJWN hiuYnE9ANxy8NEqj7Pz1Ut6T2M71YB+Lq8tW6zaNuzjOPwC+TQ+AIwA7REYfzOn2UZV8Tm nbAABYgy57HJhq61JKlY/ZmGBURneEYOEiE5e2TkQ/2w6giTiGpvEAqVoLUoRTZjRFuagH OhlKXaPTX8Y7AxvLSFw9gI/vUr4u2w88gKQmdxXIEV7pVtkb1X7bzLNXhcZ704hcT11w9M 4BnB8A+0NEHF/gUVQEWeiWNYs/H9KNBNo4KTFgXA2vicjsCi0nOMdlNkMtYm7w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667474808; a=rsa-sha256; cv=none; b=HnyKOWZtAqunuMTCprDv/9H4SW+fU6IDs2ElS7QPkMmfYXAHh2VSFGDSY78HdabZgcdONB wTASOZiSriKBbN2PFX6mgYP8nIn5CoxljDOAIN/u8iSFggKpxFcFX2C08xcdmFnaK3e3N3 WkogV5e/WhGFlLWcQB2fZNzr9ChQfGD2vRcdyOLMHP42ICfJhRilfC80J8UJbdQJWWVuan pFnM23Tt82hYZjAW1TkXrgE18gwEszS/r2AFGldUkn2tI5D9dTCevJmzpXhjxMxYf8qwCR GFPudfON2wA/lqeXYx/MZo6mVbqpLer7xKaHYaxqoLB7zAu/YwkG3+MowI3+OA== 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="OA1l7H/i"; 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: -4.69 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="OA1l7H/i"; 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: 4709C2D194 X-Spam-Score: -4.69 X-Migadu-Scanner: scn0.migadu.com X-TUID: Gq/hHP1w3Ldl Hi! Mathieu Othacehe skribis: >> =E2=80=98pointer->device!=E2=80=99 attempts to do that but I think = it=E2=80=99s bogus: it >> uses a weak-value hash table, where the value is the wrapper. So >> if the wrapper disappears before the underlying C object, then the >> pointer is called and bad things ensue. > > I'm not sure to understand how could the wrapper disappear before the > underlying C object? We are only exposing records to the > Guile-Parted users so my assumption is that when goes out of > scope, the pointer it wraps can be freed, but I'm maybe missing > something? Hmm you=E2=80=99re right (and yes it=E2=80=99s the same as =E2=80=98define-= wrapped-pointer-type=E2=80=99 does). So that should be fine. > Regarding object lifetime, I wrote a small memo in 2019 here: > https://issues.guix.gnu.org/36402#11. Nice, though it does feel like we=E2=80=99re running in circles. :-) > We have three weak hash tables in Guile-Parted: > > %devices: To make sure that we do not set multiple finalizers on the > same pointers. > > %disk-devices: So that a device always outlives its disks. > > %partition-disks: So that a disk always outlives its partitions. > > This means that as far as I can tell we are OK regarding your second > point about "aggregation relations". OK. Another thing to keep in mind: finalizers run in a separate thread, so finalization can happen concurrently. That can be problematic is there is shared global state in the library that=E2=80=99s being access when an benign-looking free function is called. Could you show the backtrace of the other threads as well, preferably with debugging info? Thanks, Ludo=E2=80=99.