From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 03 05:13:39 2019 Received: (at 36402) by debbugs.gnu.org; 3 Sep 2019 09:13:39 +0000 Received: from localhost ([127.0.0.1]:59308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i54sa-0002CW-Hr for submit@debbugs.gnu.org; Tue, 03 Sep 2019 05:13:36 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51561) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i54sZ-0002CI-2c for 36402@debbugs.gnu.org; Tue, 03 Sep 2019 05:13:36 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49530) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1i54sT-00070K-Hv; Tue, 03 Sep 2019 05:13:29 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=60936 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1i54sS-0002U6-Vg; Tue, 03 Sep 2019 05:13:29 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Mathieu Othacehe Subject: Re: bug#36402: installation error References: <87lfxmu47j.fsf@gnu.org> <878sr989br.fsf@gmail.com> <87a7bnaj0b.fsf@gnu.org> <87imqbgh71.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 17 Fructidor an 227 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 03 Sep 2019 11:13:26 +0200 In-Reply-To: <87imqbgh71.fsf@gmail.com> (Mathieu Othacehe's message of "Mon, 02 Sep 2019 11:50:42 +0200") Message-ID: <87woepyc7d.fsf@gnu.org> 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-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 36402 Cc: 36402@debbugs.gnu.org, Juan X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello, Mathieu Othacehe skribis: >> It might be useful to add calls to =E2=80=98gc=E2=80=99 here and there i= n the tests to >> stress-test memory management. > > Inserting gc calls here: > > (test-assert "partition-remove extended" > (with-tmp-device > "device-extended.iso" > (lambda (new-device) > (let* ((device (get-device new-device)) > (disk (disk-new device)) > (partitions (disk-partitions disk)) > (extended-partition (find extended-partition? partitions))) > (gc) ; <-- Try to destroy disk? > (disk-remove-partition* disk extended-partition) > (gc) > (equal? (extended-partition-count disk) 0))))) > > causes a segfault. Is it legal to call GC here? Do you have any clue on > how to investigate what the GC is doing? GC might run at any time, so yes, it=E2=80=99s valid to insert calls to =E2= =80=98gc=E2=80=99 anywhere. So this is good, this is kind of issue we want to catch. :-) To investigate, I would recommend re-reading how memory management works in Parted. Questions such as: 1. Can Parted free a C object (disk, partition, etc.) behind your back? Is there a way to prevent it? 2. When a Parted object aggregates another object, how=E2=80=99s memory managed? For example, if a =E2=80=9Cdisk=E2=80=9D aggregates (refers = to) a =E2=80=9Cpartition=E2=80=9D, who=E2=80=99s responsible for freeing tha= t partition? 3. Relatedly, if, say, a =E2=80=9Cdisk=E2=80=9D aggregates a =E2=80=9Cpar= tition=E2=80=9D, do you make sure on the Scheme side that you do not free the partition while the disk is still alive? You can make sure this doesn=E2=80=99t happen by using a weak-key hash table, as discussed before, where the key is the disk and the value is the list of partitions it aggregates. If you can get a backtrace from the core dump, that might give clues. Setting the environment variable: export GLIBC_TUNABLES=3Dglibc.malloc.check=3D1 might tell you if it=E2=80=99s a double-free error or something. You can also use Valgrind though libgc creates a lot of noise there. Please share whatever you gather before you get depressed. ;-) HTH! Ludo=E2=80=99.