openswoole / ext-openswoole

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

Unknown option [dns_cache_refresh_time] #244

Closed dompie closed 1 year ago

dompie commented 2 years ago
  1. What did you do? If possible, provide a simple script for reproducing the error.
    
    $server = new Server($_ENV['WEBSOCKET_HOST'], $_ENV['WEBSOCKET_PORT']);
    $server->set([
    [...]
    'dns_cache_refresh_time' => 60,
    [...]
    ]);

According to docs this option should work: https://openswoole.com/docs/modules/swoole-server/configuration#dns_cache_refresh_time

2. What did you expect to see?

No PHP warning that dns_cache_refresh_time is an unknown option

3. What did you see instead?

apps/frontend/websocket$ php -f messengerServer.php PHP Warning: Unknown option [dns_cache_refresh_time] in @swoole-src/library/core/Server/Helper.php on line 164

0 Swoole\Server\Helper::checkOptions()

1 Swoole\Server\Port->set()

2 Swoole\Server->set() called at [[...]apps/frontend/websocket/messengerServer.php:49]

[31.Aug 11:08:19.31246][INFO] Websocket server started at ws://127.0.0.1:8080

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

openswoole

Open Swoole => enabled Author => Open Swoole Group hello@openswoole.com Version => 4.11.1 Built => Aug 26 2022 10:57:36 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 http2 => enabled json => enabled curl-native => enabled pcre => enabled zlib => 1.2.11 mutex_timedlock => enabled pthread_barrier => enabled futex => enabled mysqlnd => enabled async_redis => enabled

Directive => Local Value => Master Value swoole.enable_coroutine => On => On swoole.enable_library => On => On swoole.enable_preemptive_scheduler => Off => Off swoole.display_errors => On => On swoole.use_shortname => On => On swoole.unixsock_buffer_size => 8388608 => 8388608

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

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.1' --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-Av3uEd/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.1)



You can also try the following OpenSwoole support channels:

* [Documentation](https://openswoole.com/docs) - Documentation for Open Swoole
* [Slack](https://goo.gl/forms/wooTTDmhbu30x4qC3) - Slack channel of Open Swoole
* [Discord](https://discord.gg/5QC57RNPpw) - Discord server of Open Swoole
doubaokun commented 1 year ago

Please use the following API to update the dns cache:

<?php
//4.x
swoole_async_set(['dns_cache_refresh_time' => 60]);
//22.x
Openswoole\Util::setAio(['dns_cache_refresh_time' => 60]);