runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Swoole runtime error on stress test

Open CViniciusSDias opened this issue 10 months ago • 4 comments

When recieving a big number of requests (via stress test, for example) while having hook_flags set to SWOOLE_HOOK_ALL, the Runtime triggers the following Swoole error:

app-1 | [2024-04-16 22:31:36 $7.0] WARNING Server::check_worker_exit_status(): worker(pid=19, id=3) abnormal exit, status=0, signal=11 app-1 | A bug occurred in Swoole-v5.1.1, please report it. app-1 | The Swoole developers probably don't know about it, app-1 | and unless you report it, chances are it won't be fixed. app-1 | You can read How to report a bug doc before submitting any bug reports: app-1 | >> https://github.com/swoole/swoole-src/blob/master/.github/ISSUE.md app-1 | Please do not send bug reports in the mailing list or personal letters. app-1 | The issue page is also suitable to submit feature requests. app-1 | app-1 | OS: Linux 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 app-1 | GCC_VERSION: 12.2.0 app-1 | PHP_VERSION : 8.3.4 app-1 |

If I try to use the hook_flag in a bare Swoole server, without Symfony runtime, I get no error. Example:

<?php

use Swoole\Http\Request;
use Swoole\Http\Response;
use Swoole\Http\Server;

$server = new Server('0.0.0.0', 8000, SWOOLE_PROCESS, SWOOLE_SOCK_TCP);
$server->set([
    'hook_flags' => SWOOLE_HOOK_ALL
]);
$server->on('request', function (Request $request, Response $response) {
    $response->end('Ok');
});

$server->start();

This does not trigger any error on the same stress test.

Steps to reproduce:

  1. Create a Symfony project;
  2. Install Swoole Runtime;
  3. Create a simple controller (just having return $this->json('Ok'); is enough) to /example;
  4. Run the following stress test: docker run --rm -it williamyeh/wrk -c 100 -d 1 -t8 http://host.docker.internal:8000/example;
  5. Check the application logs and see the error.

Simply changing the hook flags to something like SWOOLE_HOOK_ALL & ~SWOOLE_HOOK_FILE & ~SWOOLE_HOOK_STDIO makes the error go away, so I assume it's a problem that happens when logs are added.

I also opened an issue here: https://github.com/swoole/swoole-src/issues/5294

CViniciusSDias avatar Apr 16 '24 22:04 CViniciusSDias