workerman 版本 4.1.13,正常啟動(dòng)worker服務(wù)(tcp、http、ws)等后,客戶端正常鏈接,運(yùn)行 php start.php status 顯示正常,但是運(yùn)行 php start.php connections 時(shí),無數(shù)據(jù)返回,檢查代碼后發(fā)現(xiàn)是未找到 .connections 文件
原始代碼 945行左右
$statistics_file = static::$statusFile ? static::$statusFile : __DIR__ . "/../workerman-$master_pid.$command"
替換為
$statistics_file = static::$statusFile ? static::$statusFile : __DIR__ . "/../workerman-$master_pid.status"
按代碼的意思是,在執(zhí)行 php start.php connections
命令的時(shí)候,回去查找對(duì)應(yīng)的 workerman-$master_pid.connections
文件,這個(gè)文件是調(diào)用:
writeConnectionsStatisticsToStatusFile()
程序正常運(yùn)行時(shí),卻沒有執(zhí)行到這里
case \SIGIO:
static::writeConnectionsStatisticsToStatusFile();
break;
操作系統(tǒng):Linux version 3.10.0-1062.el7.x86_64
PHP版本:PHP 7.3.11 (cli) (built: Apr 11 2020 11:10:11) ( NTS )
workerman: 4.1.13
剛測試了下沒問題,也沒有用戶反饋過這個(gè)問題,需要你本地自己調(diào)試定位下
946行
要將 workerman-$master_pid.$command
替換成 workerman-{$master_pid}.status
否則php start.php connections不會(huì)打印出文件內(nèi)容
這應(yīng)該是試圖將status和connections文件分開但沒有處理好