From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id YD0wI3xAOmDGOAAA0tVLHw (envelope-from ) for ; Sat, 27 Feb 2021 12:52:12 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 6NjeHnxAOmC5TwAAbx9fmQ (envelope-from ) for ; Sat, 27 Feb 2021 12:52:12 +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 aspmx2.migadu.com (Postfix) with ESMTPS id C81C110829 for ; Sat, 27 Feb 2021 13:52:11 +0100 (CET) Received: from localhost ([::1]:47424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFz4r-0005jE-Qw for larch@yhetil.org; Sat, 27 Feb 2021 07:52:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFz4k-0005j5-Ou for bug-guix@gnu.org; Sat, 27 Feb 2021 07:52:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:60045) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lFz4k-0004er-HZ for bug-guix@gnu.org; Sat, 27 Feb 2021 07:52:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lFz4k-0007js-FG for bug-guix@gnu.org; Sat, 27 Feb 2021 07:52:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#46796: Cuirass & pointer finalization. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 27 Feb 2021 12:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46796 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 46796@debbugs.gnu.org Received: via spool by 46796-submit@debbugs.gnu.org id=B46796.161443027129691 (code B ref 46796); Sat, 27 Feb 2021 12:52:02 +0000 Received: (at 46796) by debbugs.gnu.org; 27 Feb 2021 12:51:11 +0000 Received: from localhost ([127.0.0.1]:43358 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFz3u-0007io-O4 for submit@debbugs.gnu.org; Sat, 27 Feb 2021 07:51:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFz3r-0007ia-T7 for 46796@debbugs.gnu.org; Sat, 27 Feb 2021 07:51:08 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58920) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFz3m-0004Bm-27; Sat, 27 Feb 2021 07:51:02 -0500 Received: from [2a01:e0a:19b:d9a0:98e:5d4:fa52:995a] (port=45002 helo=cervin) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lFz3l-0005Tg-DP; Sat, 27 Feb 2021 07:51:01 -0500 From: Mathieu Othacehe References: <8735xihq60.fsf@gnu.org> Date: Sat, 27 Feb 2021 13:50:59 +0100 In-Reply-To: <8735xihq60.fsf@gnu.org> (Mathieu Othacehe's message of "Fri, 26 Feb 2021 15:14:31 +0100") Message-ID: <87ft1hvfm4.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1614430332; 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: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=h3rrgmerejuEfZ5ADukGlp+Bc2qQpqx8XpBzn85ito8=; b=W/YfJY6kpmgqPBEg5+1aVkBBYVldge0AmBBEmLD3VSvWqYF7jlbvtwWe7pmD3odRSzDPEO eUGemwOoHYEPpFZLgCVIhvRR5CirsTpRkgdrhsF5wVC7ym532P9BVmkvztsc70t/Va30w1 OUvTqEaDM6I1vmoGpVZEWzwSSqrgD2oqV+GngoMpT0nwBeBduQs5/9eVl9cm09eg6DyLq/ mnHMdGRJLaKmePVt4S3cQTv/dw191GI6oXYu+L1MUe8DPdXvY85GUS8N5M5vPdeU3prO9m pHmY3Q4HJCVKZWrjVyWeZ8RftplwHJ9lpZphZJ4znwTf8OZYCo+gQfHvcDiaTg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1614430332; a=rsa-sha256; cv=none; b=XiSSX19yVK+HEL7YzDDedWZii5M7a2BjVP5oe1/cbvtfTHjOlA4Ivs6pLWBxeQHQtKj8V1 VP5113SrBiEWEr/F8Vrf080iLc4+AgayUDIo9mQYVGhZZP/UX95VAr7gp2ZCl0PE07bLoA lD3RzyxgBzrqa81AdzynmYJL7tSr6RkXIzrIw6qA8+5jaWGzThzAxy2RdFWEcKeMmXyWTS O4NSCDxTTWlMxp6oYusyhG4ZcPvyTGr3Vk4Z7GKiTvKCASWkJa0JAmvOXnYacH9IfSrl6A DSfnrLuGJn/fTgO5VDnDu3sUIpOJj0no/LUqUDzwdeDbOWaBOSDE57afpKBe+w== ARC-Authentication-Results: i=1; aspmx2.migadu.com; dkim=none; spf=pass (aspmx2.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-Migadu-Spam-Score: -1.37 Authentication-Results: aspmx2.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx2.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-Migadu-Queue-Id: C81C110829 X-Spam-Score: -1.37 X-Migadu-Scanner: scn1.migadu.com X-TUID: 14GclVPEBbj8 Hey, Here's a Valgrind backtrace: --8<---------------cut here---------------start------------->8--- ==97844== Thread 17: ==97844== Invalid read of size 4 ==97844== at 0x114465B9: zmq::msg_t::close() (in /gnu/store/zd9lbfqa3170nsfd4177dnr38k1sjbnc-zeromq-4.3.4/lib/libzmq.so.5.2.4) ==97844== by 0x3A58E98F: ??? ==97844== by 0x489AC78: chained_finalizer (in /gnu/store/q8brh7j5mwy0hbrly6hjb1m3wwndxqc8-guile-3.0.5/lib/libguile-3.0.so.1.3.0) ==97844== by 0x49A16EE: GC_invoke_finalizers (in /gnu/store/iycnpxxrg8m9wf9w58d6zvp9sdby6m9d-libgc-7.6.12/lib/libgc.so.1.3.6) ==97844== by 0x489AF08: scm_run_finalizers (in /gnu/store/q8brh7j5mwy0hbrly6hjb1m3wwndxqc8-guile-3.0.5/lib/libguile-3.0.so.1.3.0) ==97844== by 0x489AF8C: finalization_thread_proc (in /gnu/store/q8brh7j5mwy0hbrly6hjb1m3wwndxqc8-guile-3.0.5/lib/libguile-3.0.so.1.3.0) ==97844== by 0x488BB09: c_body (in /gnu/store/q8brh7j5mwy0hbrly6hjb1m3wwndxqc8-guile-3.0.5/lib/libguile-3.0.so.1.3.0) ==97844== by 0x4913148: vm_regular_engine (in /gnu/store/q8brh7j5mwy0hbrly6hjb1m3wwndxqc8-guile-3.0.5/lib/libguile-3.0.so.1.3.0) ==97844== by 0x49145B4: scm_call_n (in /gnu/store/q8brh7j5mwy0hbrly6hjb1m3wwndxqc8-guile-3.0.5/lib/libguile-3.0.so.1.3.0) ==97844== by 0x4890BB9: scm_call_2 (in /gnu/store/q8brh7j5mwy0hbrly6hjb1m3wwndxqc8-guile-3.0.5/lib/libguile-3.0.so.1.3.0) ==97844== by 0x48923B9: scm_c_with_exception_handler (in /gnu/store/q8brh7j5mwy0hbrly6hjb1m3wwndxqc8-guile-3.0.5/lib/libguile-3.0.so.1.3.0) ==97844== by 0x4909C3C: scm_c_catch (in /gnu/store/q8brh7j5mwy0hbrly6hjb1m3wwndxqc8-guile-3.0.5/lib/libguile-3.0.so.1.3.0) ==97844== Address 0x7373313569316263 is not stack'd, malloc'd or (recently) free'd --8<---------------cut here---------------end--------------->8--- It looks like the finalizer is operating on a memory region that has already been free'd. The documentation associated with the finalization functions in says: --8<---------------cut here---------------start------------->8--- /* When obj is no longer accessible, invoke */ /* (*fn)(obj, cd). If a and b are inaccessible, and */ /* a points to b (after disappearing links have been */ /* made to disappear), then only a will be */ --8<---------------cut here---------------end--------------->8--- As far as I understand, OBJ is the wrapped pointer to the bytevector created in "zmq-msg-init". There's a weak reference between the pointer and the bytevector that is introduced by "register_weak_reference" in "bytevector->pointer". My interrogation is: do I have the guarantee that the pointer and its references are still readable from within the finalizer? The above snippet says that FN is invoked when OBJ is unaccessible, but does this mean its content may have already been collected? Cc'ing Ludo :) Thanks, Mathieu