Overview
You can configure two stack size parameters for Java code:
- The -Xss parameter for the native stack, used by Java code
to process calls made into native libraries.
- The -Xoss parameter for the Java stack, used for Java
method calls to track the state of variables.
For each thread in the Java virtual machine (JVM™), there is a Java
stack and a native stack. Default values include:
Platform |
-Xoss (Java stack size) |
-Xss (native stack size) |
Linux-Intel |
Default: 400KB Minimum: 100KB Maximum: None
specified |
Default: 512KB Minimum: 96KB Maximum: None
specified |
Ask the following questions:
- Does a stack overflow exist in native code or in Java
code?
- View the Java stack trace associated with the stack overflow, if this
information is available.
- Be aware that the information that is returned when the stack overflow
occurs is dependent upon the platform.
- In many cases, it is not possible to get complete or usable
information.
- Does there appear to be an infinite loop?
- Verify whether the pattern of calls repeats. Is a recursive loop of
calls occurring?
- View the source code or use a debugger to determine if a deep stack is
normal, even with some repeat calls in the stack trace.
- If there does not appear to be a loop, increase either the Java stack
or the native stack to resolve the problem.
- If there is an infinite loop in the application, the application must
be debugged and fixed.
Diagnosing a stack overflow on Linux-Intel
systems
The symptoms of a stack overflow include:
- A StackOverFlow exception in the system out or system
error file. This error is not a terminating exception. The Java process
might continue to run.
- A very deep stack that does not include a stack overflow.
This situation is typically a terminating exception, or the result of
requesting a thread dump (Java core).
- A Java core file that lists one of the following signals
might indicate a native stack problem: SIGABRT, SIGSEGV, SIGILL, or
SIGBUS.
Here is an example of the Java stack trace in the Java core file:
"Worker#12" (TID:0x82925a78,
sys_thread_t:0x322bdb18, state:R, native ID:0x2022) prio=5
----- Native Stack -----
unable to backtrace through native code - iar 0x7 not in text area (sp is
0x32ee0e00)
What to do with a Java stack or native
overflow
To fix a Java stack or native overflow:
- Increase the size of the appropriate stack incrementally.
- Test.
- Repeat these actions until the error is eliminated. To change this
stack value from the default size, specify a new value in the command-line
arguments of the Application Server.
Comments:
- The suggested starting point is double the default stack
size.
- Remember that memory is increased for each thread.
- The appropriate value can change when the Developer Kit is
upgraded.
- Increasing the stack is not the solution if
OutOfMemoryError exceptions occur with an increased stack size.
If increasing the stack sizes does not work, the following options might
resolve the problem:
|