-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swoole4.4.0关闭进程bug #2681
Comments
未能重现Bug 环境: <?php
$server = new swoole_http_server('0.0.0.0', 60003);
$server->on('workerStart', function (swoole_http_server $server, int $worker_id) {
if ($worker_id === 0) {
echo $server->master_pid . "\n";
echo $server->manager_pid . "\n";
echo $server->worker_pid . "\n";
swoole_timer_after(10000, function () use ($server) {
swoole_process::kill($server->master_pid);
});
}
});
$server->on('request', function (swoole_http_request $request, swoole_http_response $response) {
});
$server->start(); |
@phper08 ...哥们,应该是我没有说清楚,我的关闭进程操作不是用swoole_timer_after这个,我这边的关闭进程脚本是类似这样的 |
@phper08 启动和关闭操作执行脚本的用户都是同一个 |
@a07061625 你更新到最新的代码,前几天好像修了这个bug |
运行close.php后提示什么?或者能提供完整代码吗? swoole_process::kill($pid, 0); 也许传的$pid不是master_pid |
@phper08
//启动写入
|
@huanghantao 我就是用的最新版4.4.0扩展包,从pecl下载的 |
@a07061625 你用master分支的代码 |
@huanghantao 你是说直接用github上的master分支,不用那个pecl扩展包是么? |
@a07061625 对的 |
@huanghantao 我知道了,非常感谢 |
经过本人实际测试,代码参考上述截图,swoole4.4.1,swoole4.4.2依然存在上述问题,如果本人用法有问题,欢迎指正 |
当swoole版本退回到4.3.2的时候,swoole_process::kill是正常的 |
注册 |
可以配置max_wait_time 这个选项来缩短强制退出的时间,默认是30s. |
@matyhtf 好的,谢谢峰哥,我确实没有注册workerExit回调,我马上去测试下 |
@shenzhe 我设置了max_wait_time 为60秒的, |
@matyhtf 峰哥,我刚才测试了下,貌似还是不行呢?能指导下是哪里出问题了么? |
其他的代码我都没有变动,只是增加了上述代码 |
配置短点,比如2秒 |
@shenzhe 和配置的等待时间没有关系,不管配置多长时间,实际情况是在swoole4.4.3版本,swoole_process::kill以后进程一直存在,我配置的六十秒,但是过了差不多十分钟后,依然存在,改成三十秒还是一样的,并没有杀死进程 |
说明仍然有资源没被释放。
|
在swoole4.4.6版本中,该问题已经被解决,其他版本未测试 |
Please answer these questions before submitting your issue. Thanks!
What did you do? If possible, provide a simple script for reproducing the error.
服务启动正常,关闭进程的时候,使用\swoole_process::kill(main进程ID)关闭
What did you expect to see?
所有main,manager,task,worker进程全部关闭
What did you see instead?
所有main,manager,task,worker进程全部都没有关闭
如下两个操作进程全部正常关闭:
1.将swoole版本退回到4.3.2
2.exec('kill -9 ' . main进程ID)
What version of Swoole are you using (show your
php --ri swoole
)?swoole 4.4.0
What is your machine environment used (including version of kernel & php & gcc) ?
centos7.6
php7.2.19
gcc4.8.5
The text was updated successfully, but these errors were encountered: