• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JNI JVM crashing in recource_allocate_bytes in Class.forName

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic