kill -9使用新的PID重新创建过程

时间:2018-10-23 05:12:13

标签: node.js process

我的Node应用程序在端口9800上运行。 现在正在抛出Error listen EADDRINUSE :::9800

我查找了stackoverflow并尝试了所有答案。 stackoverflow reference

但是他们都没有为我工作。 kill -9是不杀死进程。它只是使用新的PID重新创建过程。

这是细节。

MacBook-Pro-2:portfolio jiahlee$ lsof -PiTCP -sTCP:LISTEN
COMMAND   PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
rapportd  404 jiahlee    3u  IPv4 0x75aeedfca27f06f5      0t0  TCP *:49170 (LISTEN)
rapportd  404 jiahlee    4u  IPv6 0x75aeedfca221604d      0t0  TCP *:49170 (LISTEN)
Python    800 jiahlee    3u  IPv4 0x75aeedfca7815d95      0t0  TCP localhost:24679 (LISTEN)
node     3071 jiahlee   12u  IPv6 0x75aeedfca221438d      0t0  TCP *:9800 (LISTEN)
MacBook-Pro-2:portfolio jiahlee$ kill -9 3071
MacBook-Pro-2:portfolio jiahlee$ lsof -PiTCP -sTCP:LISTEN
COMMAND   PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
rapportd  404 jiahlee    3u  IPv4 0x75aeedfca27f06f5      0t0  TCP *:49170 (LISTEN)
rapportd  404 jiahlee    4u  IPv6 0x75aeedfca221604d      0t0  TCP *:49170 (LISTEN)
Python    800 jiahlee    3u  IPv4 0x75aeedfca7815d95      0t0  TCP localhost:24679 (LISTEN)
node     3119 jiahlee   12u  IPv6 0x75aeedfca2215a8d      0t0  TCP *:9800 (LISTEN)
MacBook-Pro-2:portfolio jiahlee$ sudo kill -9 3119
MacBook-Pro-2:portfolio jiahlee$ lsof -PiTCP -sTCP:LISTEN
COMMAND   PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
rapportd  404 jiahlee    3u  IPv4 0x75aeedfca27f06f5      0t0  TCP *:49170 (LISTEN)
rapportd  404 jiahlee    4u  IPv6 0x75aeedfca221604d      0t0  TCP *:49170 (LISTEN)
Python    800 jiahlee    3u  IPv4 0x75aeedfca7815d95      0t0  TCP localhost:24679 (LISTEN)
node     3154 jiahlee   12u  IPv6 0x75aeedfca221438d      0t0  TCP *:9800 (LISTEN)

1 个答案:

答案 0 :(得分:0)

看起来节点进程是由某个父进程启动的,因此即使您杀死该节点进程,它也会再次启动

能不能给我下面命令的输出

lsof -n | grep 1337 | grep LISTEN