What did you do? If possible, provide a simple script for reproducing the error.
I came up this error everytime, I'm not sure why.
<?php
use OpenSwoole\Server;
use OpenSwoole\Timer;
$server = new Server('0.0.0.0', 9500);
// $server->tick(2000, function() use ($server) {
// print_r($server->stats());
// });
Timer::tick(2000, function() use ($server) {
print_r($server->stats());
});
$server->on('Receive', function(Server $server, $socket, $fromId, $data) {
print_r($data);
});
$server->start();
Output is:
$ php server.php
Segmentation fault (core dumped)
2. What did you expect to see?
Stats of the server every 2 seconds.
3. What did you see instead?
For our production code, I just added dirty way of connecting to server saving stats to the database and closing connection. Cron is the responsible instead of OpenSwoole's timer.
4. What version of OpenSwoole are you using (show your `php --ri openswoole`)?
22.0.0
5. What is your machine environment used (show your `uname -a` & `php -v` & `gcc -v`) ?
It's not about the my own computer it's common for every machine:
Linux fedora 6.4.11-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 16 17:42:12 UTC 2023 x86_64 GNU/Linux
PHP 8.2.9 (cli) (built: Aug 3 2023 11:39:08) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.2.9, Copyright (c) Zend Technologies
I came up this error everytime, I'm not sure why.
Output is:
Stats of the server every 2 seconds.
For our production code, I just added dirty way of connecting to server saving stats to the database and closing connection. Cron is the responsible instead of OpenSwoole's timer.
22.0.0
It's not about the my own computer it's common for every machine:
Linux fedora 6.4.11-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 16 17:42:12 UTC 2023 x86_64 GNU/Linux