Closed fakharksa closed 2 years ago
You must set onTask callback according to https://openswoole.com/docs/modules/swoole-server-on-task
@doubaokun Why should i create an $server->on("Task", callback()); until i am actually using it ?
By principle, the "Server Configuration" should only create a Pool of "TaskWorker Process" in memory instead of forcing developer to create (feed) a (dummy) task.
By principle, a "configuration" should behave like a "declaration / prototype ", and should never force to provide a "definition / implementation" along with it).
Philosophy: I want to declare "i will / may use Task Worker Processes" as an Application Architect, but i do not want the developer to start with providing a dummy on("task", callback());
Plus, this is not how it was in earlier versions. Therefore, i request you to please consider it as a genuine issue/ bug.
If you enable 'task_worker_num' => 8
, you must setup ontask callback. You can remove 'task_worker_num' => 8
if task workers are not used.
What did you do? If possible, provide a simple script for reproducing the error.
The server fails to start and gives error as mentioned in my response to your question 3 below.
Here is the configuration:
WARNING Server::start_check(): onTask event callback must be set PHP Fatal error: Swoole\Server::start(): failed to start server. Error: Server::start_check(): onTask event callback must be set in [my_php_file_name_with_line_number]
Openswoole version 4.11.1
I installed it using source
Output of uname -a (where fakhar is my name in my computer-name "fakhar-HP-laptop". Linux fakhar-HP-Laptop 5.17.5-76051705-generic #202204271406~1651504840~20.04~63e51bd-Ubuntu SMP PREEMPT Wed Ma x86_64 x86_64 x86_64 GNU/Linux
"Output of php -v" PHP 8.1.10 (cli) (built: Sep 18 2022 10:26:02) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.10, Copyright (c) Zend Technologies with Zend OPcache v8.1.10, Copyright (c), by Zend Technologies
"Output of gcc -v"
Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/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='Ubuntu 11.2.0-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --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-bootstrap --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-11-gBFGDP/gcc-11-11.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.2.0 (Ubuntu 11.2.0-19ubuntu1)