Gateway: Worker->name conflict怎么解决?

问题描述

环境:Workerman version:3.5.14 PHP version:7.2.8
为了分开部署演练,在同一台机器,我把Register Gateway BusinessWorker 按顺序分开启动,wokerman.log不停的提示:
2018-09-24 11:15:18 pid:9978 Gateway: Worker->name conflict. Key:127.0.0.1:MailBusinessWorker:3
2018-09-24 11:15:18 pid:9966 Gateway: Worker->name conflict. Key:127.0.0.1:MailBusinessWorker:3
2018-09-24 11:15:18 pid:9926 Gateway: Worker->name conflict. Key:127.0.0.1:MailBusinessWorker:3
2018-09-24 11:15:18 pid:9966 Gateway: Worker->name conflict. Key:127.0.0.1:MailBusinessWorker:3
2018-09-24 11:15:18 pid:9954 Gateway: Worker->name conflict. Key:127.0.0.1:MailBusinessWorker:3
2018-09-24 11:15:18 pid:9978 Gateway: Worker->name conflict. Key:127.0.0.1:MailBusinessWorker:3
导致我的磁盘很快就爆满了。

问题出现的环境背景及自己尝试过哪些方法

我看了一下源码说在一台服务器上businessWorker->name不能相同,但还是没有搞清楚怎么会提示conflict

相关代码

// bussinessWorker 进程
$worker = new BusinessWorker();
$worker->name = 'MailBusinessWorker';
$worker->count = 6;
......

请大家帮忙,什么原因导致的conflict?怎么解决?


慕婉清6462132
浏览 3419回答 1
1回答

慕尼黑5688855

问题已解决,原因:使用php管理进程:shell_exec("php MailBusinessWorker.php stop"),但却删除了主进程pid,但是子进程却没同时被删除,导致二次启动BusinessWorker,就会有冲突提示(Gateway: Worker->name conflict),同样GatewayWorker所有进程未删除干净,也一样会有conflict提示。解决方法:第一步:shell_exec("php MailBusinessWorker.php stop");第二步,写了一个Php函数,调用ps 和 kill命令,强制删除所有未删除干净的子进程总之:删除干净所有相关的worker的进程,就不会报错。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Html5