[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#58732: installer: finalizers & device destroy segfault
From: |
Ludovic Courtès |
Subject: |
bug#58732: installer: finalizers & device destroy segfault |
Date: |
Thu, 03 Nov 2022 12:25:39 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) |
Hi!
Mathieu Othacehe <othacehe@gnu.org> skribis:
>> ‘pointer->device!’ attempts to do that but I think it’s 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 <device> records to the
> Guile-Parted users so my assumption is that when <device> goes out of
> scope, the pointer it wraps can be freed, but I'm maybe missing
> something?
Hmm you’re right (and yes it’s the same as ‘define-wrapped-pointer-type’
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’re 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’s 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’.
- bug#58732: installer: finalizers & device destroy segfault, Ludovic Courtès, 2022/11/02
- bug#58732: installer: finalizers & device destroy segfault, Mathieu Othacehe, 2022/11/03
- bug#58732: installer: finalizers & device destroy segfault,
Ludovic Courtès <=
- bug#58732: installer: finalizers & device destroy segfault, Mathieu Othacehe, 2022/11/06
- bug#58732: installer: finalizers & device destroy segfault, Ludovic Courtès, 2022/11/07
- bug#58732: installer: finalizers & device destroy segfault, Mathieu Othacehe, 2022/11/07
- bug#58732: installer: finalizers & device destroy segfault, Mathieu Othacehe, 2022/11/09
- bug#58732: installer: finalizers & device destroy segfault, Ludovic Courtès, 2022/11/10
- bug#58732: installer: finalizers & device destroy segfault, Mathieu Othacehe, 2022/11/10