From: Mathieu Othacehe <m.othacehe@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 36402@debbugs.gnu.org, Juan <r5jm@protonmail.com>
Subject: bug#36402: installation error
Date: Wed, 04 Sep 2019 14:31:35 +0200 [thread overview]
Message-ID: <87imq8tf88.fsf@gmail.com> (raw)
In-Reply-To: <87woepyc7d.fsf@gnu.org>
Hey Ludo,
> Please share whatever you gather before you get depressed. ;-)
Thanks a lot for your help, it was really useful! I used valgrind a lot
to understand what was happening.
Ok so here's a little summary:
* Using ped_device_get Parted returns new devices. It may return already
existing devices if the given path is already known. Users are
responsible for their destruction calling ped_device_destroy.
* Using ped_disk_new Parted returns new disks from devices. Users are
responsible for their destruction calling ped_disk_destroy.
* A disk contains partitions. A user can remove partitions without
deleting them. It is also possible to delete them calling
ped_partition_destroy. On disk destruction, all the partitions
associated are destroyed.
Here's how memory is managed in Guile-Parted:
* ped_device_destroy is set a finalizer for device pointers.
* ped_disk_destroy is set a finalizer for disk pointers. Device object
associated to disks are recorded in a weak key hash table, to ensure
that the lifetime of a disk is shorted than that of its device.
* No finalizer is set for partition pointers. However, disk associated
to partitions are recorded in a weak key hash table, to ensure that the
lifetime of a partition is shorter that that of its disk. The user can
access ped_disk_remove_partition function from Parted but cannot acces
ped_partition_destroy function. Partition destruction is done by Parted
of disk destruction.
And here is what was going wrong:
ped_device_get and ped_device_get_next can return pointers to already
existing device object. So set-pointer-finalizer! was possibly called
multiple times on the same device pointer, resulting in calling
ped_device_destroy multiple times on the same device pointer.
To prevent that, I created a weak value hash table to make sure that one
<device> object maps to exactly one device pointer, and that the pointer
finalizer is set only once. See commit b35839b.
I also added (gc) calls at various locations in the tests in commit
728fd01.
WDYT?
Thanks,
Mathieu
next prev parent reply other threads:[~2019-09-04 12:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-27 1:47 bug#36402: installation error Juan
2019-06-27 21:08 ` Ludovic Courtès
2019-06-29 15:47 ` Mathieu Othacehe
2019-07-02 13:25 ` Ludovic Courtès
2019-08-31 18:43 ` Mathieu Othacehe
2019-09-01 19:55 ` Ludovic Courtès
2019-09-02 9:50 ` Mathieu Othacehe
2019-09-03 9:13 ` Ludovic Courtès
2019-09-04 12:31 ` Mathieu Othacehe [this message]
2019-09-05 8:32 ` Ludovic Courtès
2019-09-05 13:53 ` Mathieu Othacehe
2019-09-08 19:35 ` Ludovic Courtès
2020-03-18 17:56 ` Mathieu Othacehe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87imq8tf88.fsf@gmail.com \
--to=m.othacehe@gmail.com \
--cc=36402@debbugs.gnu.org \
--cc=ludo@gnu.org \
--cc=r5jm@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).