swoole / swoole-src

🚀 Coroutine-based concurrency library for PHP
https://www.swoole.com
Apache License 2.0
18.45k stars 3.16k forks source link

Server::check_worker_exit_status(): worker(pid=294, id=0) abnormal exit #5294

Closed CViniciusSDias closed 2 months ago

CViniciusSDias commented 7 months ago

Please answer these questions before submitting your issue.

  1. What did you do? If possible, provide a simple script for reproducing the error.

I have a small pet project and I added one docker compose service for a Swoole server and another one for the FPM server. The application can be checked here: https://github.com/CViniciusSDias/picpay-challenge/tree/swoole-plus-fpm When running docker compose up -d, everything seems to work fine and I am able to perform requests (http://localhost:8123/users, for example), but if I perform a small stress test, it gives me error responses and shows the following warning in the logs:

app-1 | [2024-04-14 14:04:43 $7.0] WARNING Server::check_worker_exit_status(): worker(pid=19, id=4) 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

This is how I executed the stress test:

docker run --rm -it williamyeh/wrk -c 100 -d 2 -t8 http://host.docker.internal:8123/users
  1. What did you expect to see?

No errors in the logs and a successful test result

  1. What did you see instead?

Only 2 requests being handled by swoole and multiple of the following logs in the output:

app-1 | [2024-04-14 14:04:43 $7.0] WARNING Server::check_worker_exit_status(): worker(pid=19, id=4) 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

  1. What version of Swoole are you using (show your php --ri swoole)?

5.1.1

  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?

uname -a in my host:

Linux NotebookG15 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

uname -a inside the container:

Linux 716673dc4297 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 GNU/Linux

php -v inside the container:

PHP 8.3.4 (cli) (built: Mar 15 2024 23:59:35) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.4, Copyright (c) Zend Technologies with Xdebug v3.3.1, Copyright (c) 2002-2023, by Derick Rethans

gcc -v inside the container:

Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-14' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-on ly --program-suffix=-12 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --en able-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --w ith-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targe ts=nvptx-none=/build/gcc-12-bTRWOB/gcc-12-12.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-12-bTRWOB/gcc-12-12.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.2.0 (Debian 12.2.0-14)

NathanFreeman commented 7 months ago

I will test it later.

NathanFreeman commented 7 months ago

Or try to follow this tutorial to see where the problem lies. https://wiki.swoole.com/en/#/other/issue?id=about-segmentation-fault-core-dump

CViniciusSDias commented 7 months ago

If I don't enable hooks, i.e., if I remove the following lines, I don't get the error:

$_SERVER['APP_RUNTIME_OPTIONS'] = [
    'settings' => [
        'hook_flags' => SWOOLE_HOOK_ALL,
    ],
];
CViniciusSDias commented 7 months ago

Setting it to SWOOLE_HOOK_ALL & ~SWOOLE_HOOK_FILE & ~SWOOLE_HOOK_STDIO also makes the error go away. So the problem seems to be with SWOOLE_HOOK_FILE and / or SWOOLE_HOOK_STDIO. With that, I assume it's a problem that happens when logs are written.

NathanFreeman commented 6 months ago

https://github.com/swoole/swoole-src/pull/5296