Skip to content
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

Get status unserialize error #889

Open
webrobot1 opened this issue Mar 9, 2023 · 5 comments
Open

Get status unserialize error #889

webrobot1 opened this issue Mar 9, 2023 · 5 comments

Comments

@webrobot1
Copy link

webrobot1 commented Mar 9, 2023

I get status in interval from worker. At file Worker.php in method formatStatusData have code

        $info = \file($statistics_file, \FILE_IGNORE_NEW_LINES);
        if (!$info) {
            return '';
        }
        $status_str = '';
        $current_total_request = array();
        $worker_info = \unserialize($info[0]);
        \ksort($worker_info, SORT_NUMERIC);

But some time situation like this

array of $info is:

Log file
(
[0] => --------------------------------------------------------------------- WORKERMAN CONNECTION STATUS --------------------------------------------------------------------------------
[1] => PID Worker CID Trans Protocol ipv4 ipv6 Recv-Q Send-Q Bytes-R Bytes-W Status Local Address Foreign Address
[2] => 20788 6.01M websocket://0.0.0.0:8090 none 2 0 3 219
[3] => 20788 none 2 tcp Redis 1 0 0B 0B 1.5KB 1.7KB ESTABLISHED 127.0.0.1:60376 127.0.0.1:6379
[4] => 20788 none 3 tcp WsProtocol 1 0 0B 0B 22.7KB 110.1KB ESTABLISHED 127.0.0.1:57902 127.0.0.1:8081
)

And i get error :

TypeError: ksort(): Argument #1 ($array) must be of type array, bool given in /var/www/html/vendor/workerman/workerman/Worker.php:1068
Stack trace:
#0 /var/www/html/vendor/workerman/workerman/Worker.php(1068): ksort()
#1 /var/www/html/vendor/workerman/workerman/Worker.php(969): Workerman\Worker::formatStatusData()
#2 /var/www/html/vendor/workerman/workerman/Worker.php(552): Workerman\Worker::parseCommand()
#3 /var/www/html/app/server/model/CommandModel.php(68): Workerman\Worker::runAll()
#4 /var/www/html/core/Cli.php(47): Fantasy\App\server\model\CommandModel::status()
@walkor
Copy link
Owner

walkor commented Mar 9, 2023

var_dump($statistics_file) and find the path then remove the file by manually.

@webrobot1
Copy link
Author

var_dump($statistics_file) and find the path then remove the file by manually.

it is not one time error. it happen always if i get worker status every 10 seconds

@webrobot1
Copy link
Author

i already delete many times and start again after some time it come again

@walkor
Copy link
Owner

walkor commented Mar 10, 2023

Do you run php start.php connections every 10 seconds too?

@webrobot1
Copy link
Author

Refer

yes. after i get status next moment i get connections. i have few workers and ask about status and connections each

walkor added a commit that referenced this issue Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants