This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: a JNI backtrace
>>>>> "BM" == Bryce McKinlay <bryce@albatross.co.nz> writes:
MD> Anyway, I'm wondering why this hash from PopSystemFrame is
MD> crashing.
BM> It looks like a JNI bug to me. I suspect _Jv_JNI_PopLocalFrame is
BM> possibly passing some sort of invalid pointer (but not null) to
BM> unmark_for_gc(), which is subsequently calling Hashtable.get()
BM> with a garbage pointer. You may need to use your new GDB to poke
BM> around and figure out if this theory is correct and if so, where
BM> the garbage in env->locals comes from.
I think _Jv_JNI_PopLocalFrame should set env->locals to the
previous frame after unmarking the current frame. Otherwise,
_Jv_GetJNIEnvNewFrame can end up making a circular link when
_Jv_MallocUnchecked re-allocates a just-freed frame and frame->next is
set to the previous value of env->locals.
So, the patch I made was to add:
env->locals = n;
immediately after:
_Jv_JNI_LocalFrame *n = rf->next;
..which did prevent the crash of the kind I reported before.