swoole / swoole-src

🚀 Coroutine-based concurrency library for PHP
https://www.swoole.com
Apache License 2.0
18.41k stars 3.16k forks source link

ErrorException: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default #4385

Closed NHZEX closed 2 years ago

NHZEX commented 3 years ago

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a simple script for reproducing the error. 使用smi2/phpclickhouse传输文件批量插入,最小复现
    
    <?php

use ClickHouseDB\Client; use function Swoole\Coroutine\run;

require_once DIR . '/vendor/autoload.php';

error_reporting(E_ALL);

Swoole\Coroutine::set([ 'hook_flags' => SWOOLE_HOOK_ALL | SWOOLE_HOOK_NATIVE_CURL, ]); run(function () { $client = new Client([ 'host' => '127.0.0.1', 'port' => '8123', 'username' => 'default', 'password' => '', ]); $client->database('erp_data'); $client->setTimeout(60); $client->setConnectTimeOut(6); $client->enableHttpCompression(true); $columns = [ 'id', 'commodity_id', 'store_id', 'class_id', '......', ]; $client->insertBatchFiles('product_info', [ DIR . '/../erp_api/runtime/dump/product.log~0825055347', DIR . '/../erp_api/runtime/dump/product.log~0825055447', DIR . '/../erp_api/runtime/dump/product.log~0825055547', ], $columns, 'JSONEachRow'); });


2. What did you expect to see?
成功插入

3. What did you see instead?

ErrorException: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in serv/vendor/smi2/phpclickhouse/src/Transport/CurlerRolling.php:318 Stack trace:

0 [internal function]: Imi\Log\ErrorLog->onError()

1 serv/vendor/smi2/phpclickhouse/src/Transport/CurlerRolling.php(318): curl_multi_exec()

2 serv/vendor/smi2/phpclickhouse/src/Transport/CurlerRolling.php(149): ClickHouseDB\Transport\CurlerRolling->exec()

3 serv/vendor/smi2/phpclickhouse/src/Transport/Http.php(622): ClickHouseDB\Transport\CurlerRolling->execLoopWait()

4 serv/vendor/smi2/phpclickhouse/src/Client.php(405): ClickHouseDB\Transport\Http->executeAsync()

5 serv/vendor/smi2/phpclickhouse/src/Client.php(628): ClickHouseDB\Client->executeAsync()

6 serv/ApiServer/Service/Collect/Logic/CollectSubmitCKLogic.php(141): ClickHouseDB\Client->insertBatchFiles()

7 serv/ApiServer/Service/Collect/Logic/CollectSubmitCKLogic.php(121): ImiApp\ApiServer\Service\Collect\Logic\CollectSubmitCKLogic->insertAll()

8 serv/ApiServer/Service/Collect/Logic/CollectSubmitCKLogic.php(61): ImiApp\ApiServer\Service\Collect\Logic\CollectSubmitCKLogic->saveDetail()

9 serv/ApiServer/Service/Collect/Command/CollectCommand.php(82): ImiApp\ApiServer\Service\Collect\Logic\CollectSubmitCKLogic->exec()

10 serv/vendor/imiphp/imi/src/Cli/ImiCommand.php(170): ImiApp\ApiServer\Service\Collect\Command\CollectCommand->submit()

11 serv/vendor/imiphp/imi/src/Cli/ImiCommand.php(159): Imi\Cli\ImiCommand->executeCommand()

12 serv/vendor/symfony/console/Command/Command.php(299): Imi\Cli\ImiCommand->execute()

13 serv/vendor/imiphp/imi/src/Cli/ImiCommand.php(136): Symfony\Component\Console\Command\Command->run()

14 serv/vendor/symfony/console/Application.php(996): Imi\Cli\ImiCommand->run()

15 serv/vendor/symfony/console/Application.php(295): Symfony\Component\Console\Application->doRunCommand()

16 serv/vendor/symfony/console/Application.php(167): Symfony\Component\Console\Application->doRun()

17 serv/vendor/imiphp/imi-swoole/src/SwooleApp.php(74): Symfony\Component\Console\Application->run()

18 serv/vendor/imiphp/imi/src/App.php(102): Imi\Swoole\SwooleApp->run()

19 serv/vendor/imiphp/imi-swoole/bootstrap.php(69): Imi\App::run()

20 {main}


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

Swoole => enabled Author => Swoole Team team@swoole.com Version => 4.7.1 Built => Aug 19 2021 09:52:29 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`) ?

Linux homestead 5.4.0-77-generic #86-Ubuntu SMP Thu Jun 17 02:35:03 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

PHP 7.4.21 (cli) (built: Jul 1 2021 16:09:41) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.21, 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.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)

matyhtf commented 2 years ago

2021-09-30 16-36-05 的屏幕截图 2021-09-30 16-42-13 的屏幕截图 2021-09-30 16-36-18 的屏幕截图 2021-09-30 16-36-12 的屏幕截图

确实产生了 warning,但是实际上是执行成功的。经过分析是在 fclose 之后又执行了 curl_multi_exec ,这里只是会产生一个 wanring,并不影响代码的正确执行。

请忽略掉这个错误。