ext-openswoole icon indicating copy to clipboard operation
ext-openswoole copied to clipboard

Issue with stream_select($read, $write, $except, $sec, $usec) and WARNING ReactorEpoll::add(): failed to add events

Open EdmondDantes opened this issue 2 years ago • 0 comments

  1. What did you do? If possible, provide a simple script for reproducing the error.
    protected function do_select(?int $sec, int $usec)
    {
        if ($this->sock === null || !is_resource($this->sock)) {
            $this->sock = null;
            throw new AMQPConnectionClosedException('Broken pipe or closed connection', 0);
        }
        
        $read                       = [$this->sock];
        $write                      = null;
        $except                     = null;
        
        if ($sec === null) {
            $usec                   = 0;
        }
        

        // bug HERE!!!
        return stream_select($read, $write, $except, $sec, $usec);
    }


  1. What did you expect to see?
No issues

  1. What did you see instead?
[2024-01-01 15:30:16 @153256.0]	WARNING	ReactorEpoll::add(): failed to add events[fd=16#0, type=7, events=512], Error: File exists[17]


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

Open Swoole => enabled
Author => Open Swoole Group <[email protected]>
Version => 22.1.2
Built => Dec 30 2023 17:58:07
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1f  31 Mar 2020
dtls => enabled
hook-curl => enabled
pcre => enabled
zlib => 1.2.11
mutex_timedlock => enabled
pthread_barrier => enabled
futex => 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


  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?
Linux X 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
PHP 8.3.0 (cli) (built: Nov 24 2023 08:49:45) (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
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --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 --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --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-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) 

There is a possibility that the source of the problem occurs after calling $server-shutdown(). Perhaps this method destroys internal objects and alters the expected behavior in such a way that it ceases to be normal. However, this case indicates that there are fundamental issues with the operation of HOOKS.

EdmondDantes avatar Jan 01 '24 13:01 EdmondDantes