Unexpected StackOverflowError calling into JNI

W

Winona

We're getting sporadic stack overflows making multiple calls from C to
Java and back again, even though it doesn't appear that we are
allocating a great deal of stack memory. Here's a typical stack dump:

java.lang.reflect.InvocationTargetException:
java.lang.StackOverflowError
at script.base_class.isMob(Native Method)
at script.library.ai_lib.isAiDead(ai_lib.java(Inlined Compiled
Code))
at
script.ai.creature_combat.OnChangedPosture(creature_combat.java(Compiled
Code))
at java.lang.reflect.Method.invoke(Native Method)
at script.script_entry.runScript(script_entry.java(Compiled
Code))
at script.script_entry.runScripts(script_entry.java(Compiled
Code))
at script.base_class.setPostureClientImmediate(Native Method)
at script.library.ai_lib.aiSetPosture(ai_lib.java:2284)
at script.ai.ai.OnHibernateBegin(ai.java(Compiled Code))
at java.lang.reflect.Method.invoke(Native Method)
at script.script_entry.runScript(script_entry.java(Compiled
Code))
at script.script_entry.runScripts(script_entry.java(Compiled
Code))

The calls to script.base_class.isMob() and
script.base_class.setPostureClientImmediate() are calls into our
native C code. script.script_entry.runScripts() is the entry point
from the C code into Java.

The situation always seems to follow the same pattern: we call from C
to Java and back, and on the 2nd time we call from Java to C, we get a
stack exception. However, this isn't repeatable; we can make the same
sequence of calls with the same data and everything works fine. This
also only appears to happen after the program has run for several
hours.

We're running IBM Java version 1.3.1 sr 4, with options -Xoss2048k,
-Xss2048k, -Xms128m, and -Xmx512m. The platform is Redhat Linux 7.3,
glibc version 2.2.5.

Any suggestions about what might be going wrong, or a way to examine
the stack memory at runtime, would be greatly appreciated.

Thanks in advance!
Steve Jakab
Sony Online Entertainment
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top