Rate This Document
Findability
Accuracy
Completeness
Readability

Java Process Hangs

Fault Locating

The Java program does not meet the service execution requirements and is hung. Figure 1 shows how to locate and rectify the fault.

Figure 1 Fault locating of the Java process hanging problem
  1. Locate the fault based on the error information in the service logs.
  2. Compare and analyze the running of x86 and Kunpeng.
    1. Check whether the hanging also occurs on x86 under the same conditions.
    2. Increase the memory parameter and check whether the problem recurs.

    Check whether the problem is caused by the code logic based on the preceding two steps.

  3. Compare JVM differences, such as the default parameters. Check whether there are differences and analyze the impact of the differences on the program.
  4. Adjust the differences to ensure that the Kunpeng platform is consistent with the x86 platform, and check whether the problem is resolved.

Cases

Symptom

After some software is ported to the Kunpeng server, the available memory is used up during the pressure test for three hours. The main service process on the Kunpeng server is suspended. However, no exception occurs during the pressure test for eight hours on an x86 server.

Fault Locating

  1. Analyze the memory monitoring data. According to the data, the CPU usage of the Kunpeng is stable, and the memory usage approaches the threshold after a period of time.
  2. Compare the Kunpeng environment and the x86 environment. The comparison shows that the two environments have the same standard hardware configuration.

    The system runs stably on x86, and no memory leak occurs. The same code is used in the Kunpeng and x86 architectures. Therefore, it can be concluded that the memory insufficiency is not caused by memory leaks.

  3. Configure the maximum memory on the Kunpeng. After the test, no hanging occurs. The possibility of memory leak is low.
  4. Compare JVM running parameters and find the differences. Pay attention to memory-related parameters, including GC parameters and space allocation parameters.
    • Similarities: The startup parameters and GC configurations are the same.
    • Differences: The default parameter values of the thread stack are different. The default parameter value of Kunpeng is 2048, and that of x86 is 1024. Based on the memory usage, 450 more threads can be started on Kunpeng, and an extra 450 MB memory is occupied. Based on the proportion, the actual used memory will exceed 95% of the maximum memory, and a hang caused by OOM may occur.
  5. Change the thread stack size to 1024. After a long-term stability test, the problem does not recur.