Skip to content

Swoole runtime error on stress test #171

Closed
@CViniciusSDias

Description

@CViniciusSDias

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: swoole/swoole-src#5294

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions