From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30266 invoked by alias); 1 Nov 2004 20:44:22 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org Received: (qmail 30251 invoked by uid 48); 1 Nov 2004 20:44:21 -0000 Date: Mon, 01 Nov 2004 20:44:00 -0000 Message-ID: <20041101204421.30247.qmail@sourceware.org> From: "Hans dot Boehm at hp dot com" To: java-prs@gcc.gnu.org In-Reply-To: <20041101172052.18266.ovidr@users.sourceforge.net> References: <20041101172052.18266.ovidr@users.sourceforge.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libgcj/18266] SIGSEGV in GC_register_finalizer_inner () X-Bugzilla-Reason: CC X-SW-Source: 2004-q4/txt/msg00290.txt.bz2 List-Id: ------- Additional Comments From Hans dot Boehm at hp dot com 2004-11-01 20:44 ------- This would be a lot easier if libgcj had been built with something like -O2 -g. Based on approximate manual matching of the object code to finalize.s, I think this is failing around line 452 of finalize.c on the line new_fo -> fo_object_size = hhdr -> hb_sz; It appears that hhdr is in %edx and is 1. This can occur if the first argument to GC_register_finalizer_inner is a pointer to somewhere in the second page of a large object. It should of course be a base pointer to an object, so this should be impossible. I think the GC_register_finalizer_no_order call must be coming from maybe_remove_all_heavy(), which called remove_all_heavy, which was presumably inlined into _Jv_MonitorExit(). I see no other path to GC_register_finalizer_no_order(). That makes it appear that an object whose heavy-weight lock we are about to remove has previously been garbage collected. That should be impossible since we previously registered our own finalizer for the object in question, and that acquires the lock bit in the lock hash table entry, as does remove_all_heavy. Thus the finalizer should have previously been run to completion, and all traces of the heavy lock should have been previously removed. Are there places we add a finalizer to an existing object without checking for prior finalizers? That might explain the problem. We really need some more evidence to confirm this chain of reasoning. A -g stack trace, and the values of the finalization proc and data (and the object the data pointer points to, if any) that are being passed to GC_register_finalizer_inner might help. So would GC_find_header (object_being_registered_address). Assuming that's one, as expected, then *GC_find_header(object_being_registered_address - 4096) together with GC_gc_no would also be somewhat interesting. Does this application use some flavor of weak references? If so, which one? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18266