Java Zombie Processes Continued

In a previous article, I mentioned the problem of Java program containers generating a lot of zombie processes. Today I ran into it again, but in a different way. The zombie processes are also generated by a bash script, but this script is executed in the K8S readinessProbe and livenessProbe, not by the java program itself. Let’s look at some failure diagrams. You can see that there are many timeout processes that are not cleaned up after execution.

Java generates a lot of zombie process problems

Recently I encountered a problem, a Java process using Runtime().exec() to execute script files, creating a large number of zombie processes, while the Java process is running in the container. At that time, I saw this situation on the Host machine, and I could see that there were a large number of zombie processes. Locate the zombie process by ps aux | grep Z. USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2518 0.