Home  >  Article  >  PHP Framework  >  worker shutdown failed

worker shutdown failed

(*-*)浩
(*-*)浩Original
2019-12-05 11:45:223466browse

worker shutdown failed

运行 php start.php stop 提示 stop fail

原因:几种可能性         (推荐学习: workerman教程

第一种可能性:

前提是以debug方式启动的workerman,开发者在终端按了ctrl z给workerman发送了SIGSTOP信号,导致workerman进入后台并挂起(暂停),所以无法响应stop命令(SIGINT信号)。

解决:

在启动workerman的终端输入fg(发送SIGCONT信号)然后回车,将workerman切回前台运行,按ctrl c(发送SIGINT信号)停止workerman。

如果无法停止,尝试运行以下两条命令

killall -9 php
ps aux|grep -i workerman|awk '{print $2}'|xargs kill -9

第二种可能性:

运行stop的用户和workerman启动用户不一致,即stop用户没有权限停止workerman。

解决:

切换到启动workerman的用户,或者用权限更高的用户停止workerman。

第三种可能性:

保存workerman主进程pid文件被删除,导致脚本找不到pid进程,导致停止失败。

解决:

将pid文件保存到安全的位置,参见手册Worker::$pidFile。

第四种可能性:

workerman主进程pid文件对应的进程不是workerman进程。

解决:

打开workerman的主进程的pid文件查看主进程pid,pid文件默认在Workerman平行的目录里。

运行命令 ps aux | grep 主进程pid 查看对应的进程是否是Workerman进程,如果不是,可能是服务器重启过,导致workerman保存的pid是过期的pid,而这个pid刚好被其它进程使用,导致停止失败。如果是这种情况,将pid文件删除即可。

The above is the detailed content of worker shutdown failed. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn