|
| Problem | Determining the cause of java.lang.StackOverflow errors for WebSphere® Application Server on Linux® - Intel® platforms along with recommended actions to correct the problems. | | Cause | When a stack overflow occurs, the amount of stack space required by the program exceeds what is configured for the stack in the Developer Kit. A stack overflow is not always caused by a problem in a Java™ program. A stack overflow can result from:- The stack size in Java being too small for the program. This can happen in a deeply-nested application; some programs require stacks that are larger than the default size; for example, a graphics-intensive Java program can require a larger stack.
- An infinite loop in an application.
- A problem in just-in-time (JIT)-compiled code that results in an call that is not valid or a loop.
| | Solution |
OverviewYou 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 overflowTo 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:
| |
| | | |
| |
|
Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, Java SDK Operating system(s): Linux Software version: 3.5, 4.0, 5.0, 5.1, 6.0 Software edition: Edition Independent Reference #: 1157072 IBM Group: Software Group Modified date: 2004-05-26
(C) Copyright IBM Corporation 2000, 2004. All Rights Reserved.
|