linux - 杀死一个java僵尸进程

标签 linux kill-process zombie-process

我正在运行一个实验性 Java 应用程序,每次我终止或停止该应用程序时,都会创建僵尸进程。我知道僵尸并不是真正的问题,因为它们(据说)不会消耗资源。但是,我的 RAM 可用空间明显少于应有的空间。这是

的转储
ps aux | grep java

3052  8.5  0.0      0     0 ?        Zl   Sep24 127:24 [java] <defunct>
6644  0.9  0.0      0     0 ?        Zl   Sep24  13:20 [java] <defunct>
8325  0.7  0.0      0     0 ?        Zl   Sep24  11:01 [java] <defunct>
8954  0.7  0.0      0     0 ?        Zl   Sep24  11:01 [java] <defunct>
16229  1.3  0.0      0     0 ?        Zl   Sep24  16:57 [java] <defunct>
19222  106  0.0      0     0 ?        Zl   Sep24 1346:37 [java] <defunct>

以下均无效:(

kill -9 PID , kill -1 PID, kill -KILL PID 

我无法重启我的机器!所以我非常欢迎任何解决方案。

最佳答案

wait(2) 手册页告诉您:

A child that terminates, but has not been waited for becomes a "zombie". The kernel maintains a minimal set of information about the zombie process (PID, termination status, resource usage information) in order to allow the parent to later perform a wait to obtain information about the child. As long as a zombie is not removed from the system via a wait, it will consume a slot in the kernel process table, and if this table fills, it will not be possible to create further processes. If a parent process terminates, then its "zombie" children (if any) are adopted by init(8), which automatically performs a wait to remove the zombies.

所以你必须寻找你的僵尸的进程ID并杀死它们。然后 init 将埋葬你的僵尸。为此,ps -fpstree 将为您提供帮助。

关于linux - 杀死一个java僵尸进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12588061/

相关文章:

c - 如何确定进程的状态(即它是否是僵尸进程)

linux - Bash 排序忽略前 5 行

mysql - 无法连接到 MySQL 服务器错误 111

linux - EMACS 24 Arch linux 不支持 256 色

java - 命令: pkill -INT -f '^php test_program.php$' 的疑问

linux - 终止流氓 "tor"进程

windows-subsystem-for-linux - 如果我不调用 waitpid(),为什么僵尸进程会从 htop 中消失?

linux cron不启动sh文件

Android 以编程方式从我们的应用程序中杀死后台应用程序

linux - init 的僵尸 child