swoole-src icon indicating copy to clipboard operation
swoole-src copied to clipboard

WARNING Server::task_unpack(): open(ravel\SerializableClosure\SerializableClosure)

Open maher1337 opened this issue 3 years ago • 8 comments

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a simple script for reproducing the error.
[$response] = Octane::concurrently([
                $data = [];
                $data_selector = $this->mode->getData($user->id);
                if (isset($data_selector)) {
                    $data = ApiResourceObject::collection($data_selector);
                }
                return $data;
]);
  1. What did you expect to see?

The API resource mapped to the variable $response

  1. What did you see instead?

A boolean false was returned instead

  1. What version of Swoole are you using (show your php --ri swoole)?
Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.6.7
Built => Dec 15 2021 08:56:57
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
pcre => enabled
zlib => 1.2.11
mutex_timedlock => enabled
pthread_barrier => enabled
futex => 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
  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?
uname -a
Linux ip-172-31-19-174 5.4.0-1030-aws #31-Ubuntu SMP Fri Nov 13 11:40:37 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
php-v
PHP 8.0.13 (cli) (built: Nov 22 2021 09:50:43) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.13, Copyright (c), by Zend Technologies
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.3.0-17ubuntu1~20.04' --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-HskZEa/gcc-9-9.3.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.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) 

Notes: The reason why this happened is because we tried to update swoole from 4.6.7 to 4.8.3 The following log can be taken from the http log that laravel produces

[2021-12-15 08:52:26 ^3014986.2]        WARNING Server::task_unpack(): open(ravel\SerializableClosure\SerializableClosure":1:{s:12:"serializable";O:46:"Laravel\SerializableClosure\Serializers\Signed":2:{s:12:"serializable";s:7123:"O:46:"Laravel\SerializableClos>

Thank you.

maher1337 avatar Dec 15 '21 15:12 maher1337

I can not reproduce this error. Here is my code and it can work successfully.

[$response, $result] = Octane::concurrently([
    fn() => UserModel::find(1)->toArray(),
    fn() => UserModel::find(2)->toArray()
 ]);

My Octane version is 1.1.0. Octane::concurrently require a callable array parameter. https://laravel.com/docs/8.x/octane#concurrent-tasks

NathanFreeman avatar Dec 19 '21 00:12 NathanFreeman

Make sure you pass it through a resource with a collection

maher1337 avatar Dec 19 '21 01:12 maher1337

Make sure you pass it through a resource with a collection

It can work successfully too if passing it with collection.

[$response, $result] = Octane::concurrently([
     fn() => UserModel::get(),
     fn() => UserModel::get()
]);
var_dump($response->toArray(), $result->toArray());

NathanFreeman avatar Dec 19 '21 01:12 NathanFreeman

Hello @NathanFreeman use an API resource. https://laravel.com/docs/8.x/eloquent-resources for more information on eloquent resources that need the model data to be passed through.

maher1337 avatar Dec 20 '21 19:12 maher1337

Hello @NathanFreeman use an API resource. https://laravel.com/docs/8.x/eloquent-resources for more information on eloquent resources that need the model data to be passed through.

OK, I will test it as soon as possible. Thanks.

NathanFreeman avatar Dec 22 '21 00:12 NathanFreeman

@maher1337 Hi. Does this error occur every time when you run the code? Could you provide more information to reproduce it? It may be caused by memory error.

NathanFreeman avatar Dec 23 '21 07:12 NathanFreeman

No it doesn't with earlier swoole version @NathanFreeman

maher1337 avatar Dec 28 '21 14:12 maher1337

Could you please show me the code of ApiResourceObject? Thanks!

NathanFreeman avatar Jan 04 '22 14:01 NathanFreeman