public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "Hans dot Boehm at hp dot com" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug libgcj/18266] SIGSEGV in GC_register_finalizer_inner ()
Date: Mon, 08 Nov 2004 19:56:00 -0000	[thread overview]
Message-ID: <20041108195600.18687.qmail@sourceware.org> (raw)
In-Reply-To: <20041101172052.18266.ovidr@users.sourceforge.net>


------- Additional Comments From Hans dot Boehm at hp dot com  2004-11-08 19:55 -------
I think this could be explained by the same problem.

This time the collector is in the Java-specific finalization pass which
marks objects reachable from objects that are about to be finalized,
so that the finalizer doesn't see deallocated memory.

It appears that the finalizable object it's marking from has somehow
been clobbered already, and no longer has a proper vtable entry.
Hence the collector dies trying to find the mark descriptor in the
vtable.

I can see how this might happen if we accidentally register a finalizer
on something that was already collected, which can happen if the
finalizer installed by hash synchronization is dropped.

It might be useful to find a little more of the context.  Try

p descr
p current_p
p type_descr
p GC_gc_no
p *mark_stack_top
up 1		-- goto GC_finalize frame
p real_ptr
p *curr_fo
x/8wx real_ptr -4

Printing *curr_fo should indicate the finalization function and "client data"
associated with this object.  It would be useful to explore the "client data"
a bit further, so that we can understand what the finalizer is really trying to 
do.
(All Java finalizers use the same function, and use the client data field to
specify what really needs to be done.)

Assuming current_p and real_ptr are the same, and you can call functions
from gdb, try

p GC_find_header(real_ptr)

If that looks like a sane pointer, also try 

p *GC_find_header(real_ptr)
p GC_base(real_ptr)

I need to look at the WeakHashMap code, but I won't get a chance to do that
for a few days.

We could also probably track this down more systematically by
having the hash synchronization code check that the vtable pointer hasn't
changed when we reregister the client finalizer around line 757 in natObject.cc.
We would have to remember the vtable pointer in the hl structure.
This might cause this to fail far more predictably, and might at
least confirm that we're not barking up the wrong tree.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18266


  parent reply	other threads:[~2004-11-08 19:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-01 17:21 [Bug libgcj/18266] New: " ovidr at users dot sourceforge dot net
2004-11-01 17:22 ` [Bug libgcj/18266] " ovidr at users dot sourceforge dot net
2004-11-01 20:44 ` Hans dot Boehm at hp dot com
2004-11-01 22:08 ` ovidr at users dot sourceforge dot net
2004-11-08  3:00 ` ovidr at users dot sourceforge dot net
2004-11-08 19:56 ` Hans dot Boehm at hp dot com [this message]
2004-11-08 20:27 ` ovidr at users dot sourceforge dot net
2004-11-25  1:50 ` Hans dot Boehm at hp dot com
2004-11-25  3:25 ` tromey at gcc dot gnu dot org
2004-11-25  3:26 ` tromey at gcc dot gnu dot org
2004-12-02 13:43 ` pinskia at gcc dot gnu dot org
2005-05-17 20:40 ` daney at gcc dot gnu dot org
2005-05-17 20:47 ` pinskia at gcc dot gnu dot org
2005-06-08 21:14 ` ovidr at users dot sourceforge dot net
2005-06-09  5:11 ` Hans dot Boehm at hp dot com
2005-06-20 16:25 ` ovidr at users dot sourceforge dot net
2005-07-19 15:06 ` ovidr at users dot sourceforge dot net
     [not found] <bug-18266-7936@http.gcc.gnu.org/bugzilla/>
2006-03-08 19:27 ` tromey at gcc dot gnu dot org

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

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

  git send-email \
    --in-reply-to=20041108195600.18687.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.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).