Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of disappearing Java process in Linux server

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Most people do not understand the knowledge points of this article "how to solve the problem of disappearance of Linux server Java process", so the editor summarizes the following, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "Linux server Java process disappearance problem how to solve" article.

Problem description

In the actual production environment, if we encounter the sudden disappearance of the Java process, how to troubleshoot the problem?

Train of thought

There may be several reasons:

Problems with ① and Java applications: the most common process Crash caused by OOM is the heap memory exception "java.lang.OutOfMemoryError: Java heap space". The troubleshooting steps are as follows:

Step1: check the JVM parameters-XX:+HeapDumpOnOutOfMemoryError and-XX:HeapDumpPath=*/java.hprof; Step2: check whether the dump file is generated according to the path specified by HeapDumpPath; Step3: if there is a dump file, use Jhat, VisualVM and other tools to analyze

②, JVM error: JVM or JDK's own Bug causes the process Crash

When JVM crashes due to a fatal error, a file such as hs_err_pid_xxx.log is generated, which contains important information that leads to JVM crash. We can locate the cause of JVM Crash by analyzing the file to ensure the stability of the system.

By default, the file is generated in the working directory, but you can also specify the generation path through the JVM parameter:

-the contents of the XX:ErrorFile=/var/log/hs_err_pid.log file mainly include the following

The log header file causes crash thread information all thread information safety point and lock information heap information local code cache compilation events gc related records jvm memory mapping jvm startup parameters server information

After you get this file, needless to say, take your time. Speaking of which, I will touch my conscience and say. This file is very complicated. If you want to be able to read this file, please make some efforts.

③ is operated by operating system OOM-Killer

The Linux kernel has a mechanism called OOM killer (Out-Of-Memory killer), which monitors processes that take up too much memory, especially those that consume a lot of memory in an instant, and the kernel kills the process in order to prevent memory exhaustion.

Therefore, if you find that the java process is suddenly gone, you should first wonder if it has been killed by linux's OOM killer!

You can look it up in the following file.

System error log: / var/log/messages

You follow orders.

Egrep-I 'killed process' / var/log/messages # egrep = grep-E can use not only basic regular expressions, but also extended expressions, where-I represents ignoring case # or grep "Out of memory" / var/log/messages

Look it up in the log.

Of course, you can also query the kernel log. Sometimes some inexplicable problems occur on the Linux system or the java or other processes running on the system, such as suddenly hanging up, such as a sudden restart, and so on. If we can't find the problem with the software, we should suspect that there is something wrong with the hardware or kernel, and we can use dmesg to see:

Dmesg-T | grep java# or dmesg-T | grep 'Out of memory'#-T is a timestamp displayed

Comparing the java log stop time, it seems that this is the root of the problem, so let's try to solve the problem by optimizing the java memory footprint and adding memory.

Note:

The dmesg command is used to display information about the kernel on a Unix-like system. The full name of dmesg is display message (or display driver), that is, display information.

In fact, the dmesg command fetches data from the kernel ring buffer. When we troubleshoot on Linux, the dmesg command is very convenient, and it can help us identify hardware-related error and warning. In addition, the dmesg command can print out daemon-related information, which has helped us debug.

The above is about the content of this article on "how to solve the problem of disappearance of Linux server Java process". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report