openswoole / ext-openswoole

Programmatic server for PHP with async IO, coroutines and fibers
https://openswoole.com
Apache License 2.0
806 stars 50 forks source link

Regression with limited error information when migrating from (PHP 8.2.13, OpenSwoole 22.1.0) to (PHP 8.3.0, OpenSwoole 22.1.0) #343

Open rhift opened 11 months ago

rhift commented 11 months ago
  1. What did you do? If possible, provide a simple script for reproducing the error.
    WARNING Server::check_worker_exit_status(): worker(pid=17, id=1) abnormal exit, status=0, signal=11
    A bug occurred in OpenSwoole-v22.1.0, please report it.
    Please submit bug report at:
    >> https://github.com/openswoole/swoole-src/issues 
    OS: Linux 6.4.16-linuxkit #1 SMP PREEMPT_DYNAMIC Thu Nov 16 10:55:59 UTC 2023 x86_64
    GCC_VERSION: 12.2.0
    PHP_VERSION : 8.3.0
  2. What did you expect to see?
    no warning
  3. What did you see instead?
    the warning
  4. What version of OpenSwoole are you using (show your php --ri openswoole)?
    
    # php --ri openswoole

openswoole

Open Swoole => enabled Author => Open Swoole Group hello@openswoole.com Version => 22.1.0 Built => Nov 28 2023 17:21:03 coroutine => enabled with boost asm context epoll => enabled eventfd => enabled signalfd => enabled cpu_affinity => enabled spinlock => enabled rwlock => enabled http2 => enabled hook-curl => enabled zlib => 1.2.13 mutex_timedlock => enabled pthread_barrier => enabled futex => enabled postgresql => enabled

Directive => Local Value => Master Value openswoole.enable_coroutine => On => On openswoole.enable_preemptive_scheduler => Off => Off openswoole.display_errors => On => On openswoole.unixsock_buffer_size => 8388608 => 8388608

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

uname -a

Linux 9bf604120846 6.4.16-linuxkit #1 SMP PREEMPT_DYNAMIC Thu Nov 16 10:55:59 UTC 2023 x86_64 GNU/Linux

php -v

PHP 8.3.0 (cli) (built: Nov 27 2023 21:24:30) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.0, Copyright (c) Zend Technologies with Zend OPcache v8.3.0, Copyright (c), by Zend Technologies

gcc -v

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-only --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 --enable-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 --with-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-targets=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)


Hey there, I know the error message isn't very helpful, but I can't figure out how to get any more information.

This is how the `\OpenSwoole\Server` is started,
```json
  "version": "22.1.0",
  "reactor_num": 16,
  "hook_flags": 2147457023,
  "log_level": 0,
  "log_file": "\/proc\/1\/fd\/1",
  "tcp_fastopen": true,
  "open_tcp_keepalive": true,
  "http_compression": true,
  "http_compression_level": 6,
  "open_http2_protocol": true,
  "compression_min_length": 128,
  "backlog": 100000,
  "reload_async": false,
  "worker_num": 8,
  "task_worker_num": 0,
  "output_buffer_size": 4294967295,
  "max_connection": 100000,
  "open_http_protocol": true,
  "open_mqtt_protocol": false,
  "open_eof_check": false,
  "open_length_check": false,

and everything works great with OpenSwoole 22.1.0 & PHP 8.2.13 (with the same configuration).

Can someone help me get more detailed error information?

Thank you!

rhift commented 11 months ago

Hey @doubaokun - I was able to reproduce this using the following,

<?php
declare(strict_types=1);

use OpenSwoole\Constant;
use OpenSwoole\Http\Request;
use OpenSwoole\Http\Response;
use OpenSwoole\Http\Server;
use OpenSwoole\Runtime;
use OpenSwoole\Util;

$Server = new Server('host.docker.internal', 62481);
$Server->set([
  'reactor_num' => Util::getCPUNum() * 2,
  'hook_flags' => Runtime::HOOK_ALL,
  'log_level' => Constant::LOG_DEBUG,
  'log_file' => '/proc/1/fd/1',
//      'open_cpu_affinity' => true,
  'tcp_fastopen' => true,
  'open_tcp_keepalive' => true,
  'http_compression' => true,
  'http_compression_level' => 6,
  'open_http2_protocol' => true,
  'compression_min_length' => 128,
  'backlog' => 100000,
  'reload_async' => false,
]);
$Server->on('Request', static function (Request $Request, Response $Response): void {
  file_put_contents('FILENAME', 'CONTENTS');
});
$Server->start();

The takeaway is if file_put_contents or file_get_contents is used during the Request event that error is then emitted.

Hoping this helps! Please let me know if there is anything else I can do to help =) Thank you!

doubaokun commented 10 months ago

It seems we can't reproduce the issues you have seen at https://github.com/openswoole/ext-openswoole/commit/2a359d1f2f6174bdbb5a582b137c6312928ebe2c. Please provide codes and open this thread again.

rhift commented 10 months ago

hey @doubaokun - it seems like the other key is to have seemingly any Preload script defined. I just use one that does nothing.

I have put together and tested this repository which will build and run a container that exhibits this behavior.

Thanks so much, and please let me know if I can help further!

rhift commented 10 months ago

Hey there, should I open a new ticket?

rhift commented 10 months ago

Hi there, this is also present in 8.3.1 fwiw (and not present in 8.2.14).

rhift commented 9 months ago

Hi again, is there anything I can do to get a project member to help me with this? I really want to get on the the latest 8.3 (which is 8.3.2 currently) and this behavior exhibits itself across all three 8.3 releases. I really appreciate the project, all the time that goes into it. I'm really looking for help at this point because I don't have the tooling or skillset to move this along any further, but I will do anything and everything I can to help or give back in some way to get this resolved. Please help me. Thank you very much =)

rhift commented 8 months ago

Present in 8.3.3 and not present in 8.2.16. Help

bitslip6 commented 5 months ago

I might have some cycles to look into this. Is this still the case? I am unable to reproduce on 8.3.2 with Swoole 22.1.2. Can you send output of php -i ?

rhift commented 5 months ago

Hey there @bitslip6, any help would be greatly appreciated.

It is present so far in every PHP release >=8.3.0.

Are you familiar with Docker? I have published a Github repository that demonstrates this behavior,

https://github.com/QuantafireIO/343

This way it is easy to observe (just change the version of PHP or Open Swoole in the Dockerfile) and eliminates any doubt about technology versions, etc. The README lists the few steps to build, run, and observe this issue.

I have updated the PHP version in the Dockerfile now to the latest at this time, 8.3.7, in which the issue is still present. I am more than happy to help in any way that I can.

Thank you very much for your interest, time, and efforts =)