GNU bug report logs - #26503
Local variables reclaimed early vs. finalizers

Previous Next

Package: guile;

Reported by: ludo <at> gnu.org (Ludovic Courtès)

Date: Fri, 14 Apr 2017 21:58:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> igalia.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Andy Wingo <wingo <at> igalia.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#26503: closed (Local variables reclaimed early vs. finalizers)
Date: Wed, 19 Apr 2017 12:25:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 19 Apr 2017 14:23:59 +0200
with message-id <87y3uwoaao.fsf <at> igalia.com>
and subject line Re: bug#26503: Local variables reclaimed early vs. finalizers
has caused the debbugs.gnu.org bug report #26503,
regarding Local variables reclaimed early vs. finalizers
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
26503: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=26503
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: ludo <at> gnu.org (Ludovic Courtès)
To: bug-guile <at> gnu.org
Subject: Local variables reclaimed early vs. finalizers
Date: Fri, 14 Apr 2017 23:56:50 +0200
Hello!

Consider this code:

--8<---------------cut here---------------start------------->8---
(use-modules (system foreign))

(define %table
  (make-weak-value-hash-table))

(define %abort
  (dynamic-func "abort" (dynamic-link)))

(let ((ptr (make-pointer 123 %abort)))
  (display "hello\n")
  (gc))
--8<---------------cut here---------------end--------------->8---

Guile is free to collect ‘ptr’ when ‘gc’ is called since it has become
unreachable at that point; that’s what 2.2.0 does, as explained in
‘NEWS’.

However, there’s a finalizer here so collecting ‘ptr’ has an observable
side effect.  This side effect makes the semantic change visible: the
“expected” semantics would be that ‘ptr’ is not subject to GC while it’s
in scope.

(In 2.0 the finalizer is not called until ‘ptr’ is no longer in scope.)

I’m not sure this counts as a bug, but it’s certainly a pitfall when
working with finalizers and the FFI.

Thoughts?

Ludo’.


[Message part 3 (message/rfc822, inline)]
From: Andy Wingo <wingo <at> igalia.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 26503-done <at> debbugs.gnu.org
Subject: Re: bug#26503: Local variables reclaimed early vs. finalizers
Date: Wed, 19 Apr 2017 14:23:59 +0200
On Wed 19 Apr 2017 11:50, ludo <at> gnu.org (Ludovic Courtès) writes:

> I need to chew a bit more on this, but the conclusion is probably that
> my expectations were incorrect, indeed.  :-)

OK I close this bug in the meantime then :)  Feel free to reopen if
there is a thing to do!

Andy


This bug report was last modified 8 years and 120 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.