Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JNI JVM crashing in recource_allocate_bytes in Class.forName

 
Tomasz Romanowski
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well since there doesnt seem to be a dedicated forum that specifically includes JNI I thought I'd try this one. Basically I got a C++ server application and a JNI bridge. Inside of java code I make a few calls to Class.forName(<classname>)
The program seems to work when I run a request trough my server the first time. When I run another request however the program crashes and the callstack shows it's crashing within the JNI JVM as below. What could it possibly be? Is my C++ code thrashing memory and stomping over JVM? Any ideas would be appreciated, thanks Thomas


[Switching to Thread 0x43002940 (LWP 29233)]
0x00002aaaab26a8f1 in resource_allocate_bytes(unsigned long) ()
from /opt/ThirdParty/8.2/lib/libjvm.so
(gdb) where
#0 0x00002aaaab26a8f1 in resource_allocate_bytes(unsigned long) ()
from /opt/ThirdParty/8.2/lib/libjvm.so
#1 0x00002aaaab33411b in UNICODE::as_utf8(unsigned short*, int) ()
from /opt/ThirdParty/8.2/lib/libjvm.so
#2 0x00002aaaaafebf3c in java_lang_String::as_utf8_string(oopDesc*, int, int) ()
from /opt/ThirdParty/8.2/lib/libjvm.so
#3 0x00002aaaab021c90 in jni_GetStringUTFRegion () from /opt/ThirdParty/8.2/lib/libjvm.so
#4 0x00002aaaaaac226c in Java_java_lang_Class_forName0 () from /opt/ThirdParty/8.2/lib/libjava.so
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It does look like the Java heap has been damaged, someplace. It's possible that it's stray pointers in your C++ code wreaking havoc, but more likely it's something your JNI code is doing wrong. JNI can be tricky and it's easy to make a mess without realizing it. How much JNI code are we talking about?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!