首页
下载
文档
社区
视频
捐赠
源代码
赞助商
AOT 编译器
AI 助理
商业产品
PHP AOT 原生编译器
Swoole-Compiler 代码加密器
CRMEB 新零售社交电商系统
登录
注册
全部
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
发表新帖
swoole 进程繁忙时候\Swoole\Process::kill($pid, SIGTERM)终止运行后出现一大堆僵尸进程
### 问题描述 swoole 创建了一个 websocket, 对这个长连接进行压力测试连接保持中,当我使用使用 \Swoole\Process::kill($pid, SIGTERM) 想要终止程序运行的时候,进程没有全部结束出现了一大堆僵尸进程,“请问有没有什么好的方法避免出现僵尸进程” ? 我尝试了一些方法都不行,现在唯一想到的就是把子进程id记录下来循环杀进程id了 ### Swoole版本4.8.5,PHP版本8.1,以及操作系统版本信息centos ### 相关代码 ```php root 8962 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8963 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8964 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8965 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8966 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8967 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8968 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8969 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8970 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8971 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8972 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8973 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8974 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8975 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8976 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8977 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8978 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8979 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8980 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8981 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8982 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8983 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8984 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8985 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8986 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8987 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8988 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8989 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8990 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8991 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8992 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8993 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8994 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8995 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8996 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8997 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8998 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8999 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9000 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9001 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9002 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9003 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9004 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9005 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9006 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9007 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9008 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9009 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9010 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9011 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9012 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9013 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9014 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9015 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9016 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9017 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9018 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9019 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9020 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9021 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9022 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9023 8926 0 19:39 pts/1 00:00:00 [php] <defunct> ``` ### 你期待的结果是什么?实际看到的错误信息又是什么? swoole 创建了一个 websocket, 对这个长连接进行压力测试连接保持中,当我使用使用 \Swoole\Process::kill($pid, SIGTERM) 想要终止程序运行的时候,进程没有全部结束出现了一大堆僵尸进程,“请问有没有什么好的方法避免出现僵尸进程” ? 我尝试了一些方法都不行,现在唯一想到的就是把子进程id记录下来循环杀进程id了
发布于4年前 · 13 次浏览 · 来自
提问
amle
### 问题描述 swoole 创建了一个 websocket, 对这个长连接进行压力测试连接保持中,当我使用使用 \Swoole\Process::kill($pid, SIGTERM) 想要终止程序运行的时候,进程没有全部结束出现了一大堆僵尸进程,“请问有没有什么好的方法避免出现僵尸进程” ? 我尝试了一些方法都不行,现在唯一想到的就是把子进程id记录下来循环杀进程id了 ### Swoole版本4.8.5,PHP版本8.1,以及操作系统版本信息centos ### 相关代码 ```php root 8962 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8963 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8964 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8965 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8966 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8967 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8968 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8969 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8970 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8971 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8972 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8973 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8974 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8975 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8976 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8977 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8978 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8979 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8980 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8981 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8982 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8983 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8984 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8985 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8986 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8987 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8988 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8989 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8990 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8991 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8992 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8993 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8994 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8995 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8996 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8997 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8998 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 8999 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9000 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9001 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9002 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9003 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9004 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9005 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9006 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9007 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9008 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9009 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9010 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9011 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9012 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9013 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9014 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9015 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9016 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9017 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9018 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9019 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9020 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9021 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9022 8926 0 19:39 pts/1 00:00:00 [php] <defunct> root 9023 8926 0 19:39 pts/1 00:00:00 [php] <defunct> ``` ### 你期待的结果是什么?实际看到的错误信息又是什么? swoole 创建了一个 websocket, 对这个长连接进行压力测试连接保持中,当我使用使用 \Swoole\Process::kill($pid, SIGTERM) 想要终止程序运行的时候,进程没有全部结束出现了一大堆僵尸进程,“请问有没有什么好的方法避免出现僵尸进程” ? 我尝试了一些方法都不行,现在唯一想到的就是把子进程id记录下来循环杀进程id了
赞
0
收藏
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
登录
后参与评论
评论
2022-05-27
Rango
父进程如果不进行`wait()`操作就会出现僵尸进程,需要`gdb/strace`追踪一下父进程的运行状态,找到为什么父进程不执行`wait()`的原因,可能是父进程阻塞或者是死循环了。
赞
0
回复