unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: David Kastrup <dak@gnu.org>
Cc: 19883@debbugs.gnu.org
Subject: bug#19883: Correction for backtrace
Date: Thu, 26 Feb 2015 12:35:32 +0100	[thread overview]
Message-ID: <87k2z4dhx7.fsf@gnu.org> (raw)
In-Reply-To: <878ufld1iw.fsf@fencepost.gnu.org> (David Kastrup's message of "Thu, 26 Feb 2015 00:17:27 +0100")

David Kastrup <dak@gnu.org> skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> David Kastrup <dak@gnu.org> skribis:
>>
>>> This is embarrassing: I used the wrong executable in connection with the
>>> core dump.  With the matching executable, the coredump makes a lot more
>>> sense:
>>>
>>> #0  0x00000000 in ?? ()
>>> #1  0x0804aee0 in Smob_base<Family>::mark_trampoline (arg=0x9fbb000)
>>>     at smobs.tcc:34
>>> #2  0xb761b2da in ?? () from /usr/lib/libguile-2.0.so.22
>>> #3  0xb72751f8 in GC_mark_from () from /usr/lib/i386-linux-gnu/libgc.so.1
>>
>> Could you try commenting out all the SMOB mark functions in LilyPond?
>>
>> This doesn’t fix the bug, of course, but it’s probably a good
>> workaround: user-provided mark functions are not needed in Guile 2.0
>> since libgc scans the whole heap for live pointers.
>
> Even the test program crashes at the end (when `count' is called in
> order to traverse the created hierarchy) when you disable the setting of
> the mark function in the init method in smobs.tcc.

Could you add debugging symbols for libguile?  I don’t understand how
‘count’ gets called.

Do you know if this is a use-after-free error?  Perhaps setting
MALLOC_CHECK_=1 would give a hint.

If this is the case, Andy had the idea of turning on topological
finalization in the GC.  This may help for this particular case, but I
vaguely recall that this breaks other finalizer-related things.

(I would check by myself, but ISTR that building LilyPond “on one’s own”
is not recommended.  What would you suggest?  A Guix recipe would be
sweet.)

> A pointer to a C++ structure does not appear to protect the
> corresponding SMOB data and free_smob calls the delete operator which
> calls destructors and clobbers the memory area.

Oh, I was mistaken in my previous message.  GC scans the stack and the
GC-managed heap (stuff allocated with GC_MALLOC/scm_gc_malloc et al.),
but it does *not* scan the malloc/new heap.

So indeed, C++ objects that hold references to ‘SCM’ objects, such as
instances of ‘Smob<X>’, must either have a mark function, or they must
be allocated with scm_gc_malloc.

Would it be possible to add a ‘new’ operator to ‘Smob’ that uses
‘scm_gc_malloc’, and a ‘delete’ operator that uses ‘scm_gc_free’?

Thanks,
Ludo’.





  reply	other threads:[~2015-02-26 11:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87mvieh7mu.fsf@gnu.org>
2015-02-16 16:41 ` bug#19883: Smob's mark_smob has become unreliable in Guile 2.x David Kastrup
2015-02-16 18:13   ` bug#19883: Correction for backtrace David Kastrup
2015-02-25 22:16     ` Ludovic Courtès
2015-02-25 23:17       ` David Kastrup
2015-02-26 11:35         ` Ludovic Courtès [this message]
2015-02-26 12:32           ` David Kastrup
2015-02-26 14:03             ` Ludovic Courtès
2015-02-26 15:30               ` David Kastrup
2015-02-26 18:15                 ` Ludovic Courtès
2015-02-26 19:25                   ` David Kastrup
2015-02-27  9:55                     ` Ludovic Courtès
2015-02-27 10:18                       ` David Kastrup
2016-06-23  9:50                 ` Andy Wingo
2016-06-23 10:36                   ` Andy Wingo
2016-06-23 13:13                     ` Ludovic Courtès
2016-06-23 13:12                   ` Ludovic Courtès
2015-03-01  6:51   ` bug#19883: Smob's mark_smob has become unreliable in Guile 2.x Mark H Weaver
2015-03-01 10:09     ` David Kastrup
2015-03-01 17:02       ` Mark H Weaver
2015-03-01 18:38         ` David Kastrup
2015-03-01 15:00     ` David Kastrup
2016-10-09  7:51   ` bug#19883: The “finalized” SMOB type Artyom Poptsov
     [not found] ` <87vax2klj6.fsf@elephant.savannah>
     [not found]   ` <87fuo5hc88.fsf@gnu.org>
2016-10-09 19:00     ` Artyom Poptsov

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://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k2z4dhx7.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=19883@debbugs.gnu.org \
    --cc=dak@gnu.org \
    /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.
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).