workerman 4.1.13, connections无数据

administrator

问题描述

workerman 版本 4.1.13,正常启动worker服务(tcp、http、ws)等后,客户端正常链接,运行 php start.php status 显示正常,但是运行 php start.php connections 时,无数据返回,检查代码后发现是未找到 .connections 文件

程序代码或配置

原始代码 945行左右

$statistics_file =  static::$statusFile ? static::$statusFile : __DIR__ . "/../workerman-$master_pid.$command"

替换为

$statistics_file =  static::$statusFile ? static::$statusFile : __DIR__ . "/../workerman-$master_pid.status"

重现问题的步骤

按代码的意思是,在执行 php start.php connections 命令的时候,回去查找对应的 workerman-$master_pid.connections 文件,这个文件是调用:
writeConnectionsStatisticsToStatusFile() 程序正常运行时,却没有执行到这里

            case \SIGIO:
                static::writeConnectionsStatisticsToStatusFile();
                break;

操作系统环境及workerman/webman等具体版本

操作系统: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

465 1 0
1个回答

walkor

刚测试了下没问题,也没有用户反馈过这个问题,需要你本地自己调试定位下

  • administrator 2023-08-24

    感谢大佬回复,可能是我的姿势不对吧

  • popapple 2024-02-01

    946行
    要将 workerman-$master_pid.$command
    替换成 workerman-{$master_pid}.status
    否则php start.php connections不会打印出文件内容
    这应该是试图将status和connections文件分开但没有处理好

  • popapple 2024-02-01

    上述bug在4.1.14中稳定复现。不过master主线的5.0版本已经修复了。

  • walkor 2024-02-01

    感谢反馈,下个版本修复

🔝