|
Problem(Abstract) |
The following helps you to determine the cause of
java.lang.StackOverflowErrors for IBM® WebSphere® Application Server
running on Windows® platforms. Includes recommended actions to correct the
problem. |
|
|
|
Cause |
When a stack overflow occurs, the amount of stack space
required by the program exceeds what is configured for the stack in the
Java™ virtual machine (JVM™) process. A stack overflow can result from:
- A deeply nested application
- An infinite loop within an application
- A problem in just-in-time- (JIT) compiled code
A stack overflow is not always caused by a problem in a Java program.
Some programs require stacks that are larger than the default size; for
example, a graphics-intensive Java program can require a larger
stack. |
|
|
Resolving the
problem |
You can configure two stack size parameters for Java code:
- The -Xss parameter for the native stack is used
by Java code to process calls made into native libraries. The following is
the syntax for this parameter:
Xss<size> |
|
Where <size> has the format,
nn[K|M|G], such as -Xss400k. |
|
- The -Xoss parameter for the Java stack is used
for Java method calls to track the state of variables. The following is
the syntax for specifying the -Xoss parameter:
-Xoss<size> |
|
Where <size> has the format,
nn[K|M|G], such as -Xoss512k. |
|
These parameters can be set like any other JVM command line arguments. For
more information, see the WebSphere Application Server Information Center
search using for Java Virtual Machine command line arguments.
For each thread in the JVM, there is a Java stack and a native stack.
Default values include:
Platform |
-Xoss (Java stack size) |
-Xss (native stack size) |
Windows |
Default: 400 KB
Minimum: 100 KB
Maximum: None specified |
Default: 512 KB
Minimum: 96 KB
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.
- Realize that in many cases it is not possible to get complete or
usable information.
- Does there appear to be an infinite loop?
- Verify if 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.
The symptoms of a stack overflow include:
- A StackOverFlowError in the SystemOut or
SystemErr log files. This error is not always 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).
- Stack overflow usually results in a JVM crash. When that
occurs, a DrWtsn32.log file is usually generated and contains
errors such as the following:
DrWtsn32.log: (Search on pid=10492)
Exception number: c00000fd (stack overflow
FAULT ->708b53ff 51
push ecx
708b5400 52 push
edx
708b5401 ff1504ffbd70 call dword ptr 70bdff04
ds:70bd
708b5407 83c40c add
esp,0xc |
|
- Output from jdump usually identifies the existence
of a stack overflow in a thread. The following 2 examples show the output
from a native stack overflow:
Example 1:
*** CHECK *** possible thread
stack overflow (FFFFED1C) by r15 (00000000)
*** ERROR *** stack trace possibly aborted (000018A0 left
untraced) |
|
Example 2: |
|
*** ERROR *** definite thread
stack overflow (31BA3FE4 < 31BA4000) |
|
- When a stack overflow occurs, the javacore file might
identify a stack overflow in a thread.
Example:
"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) |
|
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 WebSphere Application Server.
Notes:
- The suggested starting point is double the default stack
size.
- Remember that increasing the stack size increases the
memory required for each thread.
- The appropriate value can change when the Java 2 SDK 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 still resolve the problem:
|
|
|
|
|
Cross Reference information |
Segment |
Product |
Component |
Platform |
Version |
Edition |
Application Servers |
Runtimes for Java Technology |
Java SDK |
|
|
|
|
|
|