TarsPHP / tars-server

11 stars 12 forks source link

用tars传输字符串类型数据量较大时日志报如下错误,接受的数据是空的 #19

Open wx1860 opened 3 years ago

wx1860 commented 3 years ago

lumen.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Uncaught ErrorException: Undefined offset: 2 in /data/tars/tarsnode-data/Kdy.RpcServer/bin/src/vendor/phptars/tars-server/src/core/Server.php:509 Stack trace:

0 /data/tars/tarsnode-data/Kdy.RpcServer/bin/src/vendor/phptars/tars-server/src/core/Server.php(509): Laravel\Lumen\Application->Laravel\Lumen\Concerns{closure}(8, 'Undefined offse...', '/data/tars/tars...', 509, Array)

1 {main}

thrown in /data/tars/tarsnode-data/Kdy.RpcServer/bin/src/vendor/phptars/tars-server/src/core/Server.php:509 Stack trace:

0 /data/tars/tarsnode-data/Kdy.RpcServer/bin/src/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.php(54): Laravel\Lumen\Application->handleShutdown()

1 [internal function]: Laravel\Lumen\Application->Laravel\Lumen\Concerns{closure}()

2 {main}

主要传递base64字符串,数据大小string(59419),如果将字符串数据变小,日志不会出现错误,并能正常接受请求参数

dpp2009 commented 3 years ago

提供下完整信息 调示例代码 swoole版本 tarsphp版本

wx1860 commented 3 years ago

swoole采用4.5.1版本 "phptars/tars-server": "0.5.0" 客户端实例代码 $a = $request->file('a'); $type = $a->getMimeType(); $fileContent = file_get_contents($a->getPathname()); $fileData = base64_encode($fileContent); $baseFile = 'data:'.$type.';base64,'.$fileData; $data = [ 'file_name' => '123.png', 'dir' => 'health', 'content' => $baseFile ]; $config = Config::communicatorConfig(config('tars.deploy_cfg')); $userClient = new CommonServiceServant($config); $userClient->uploadFile(json_encode($data),$outParam);

服务端实例代码 /**

$inParam接收到是空的

bobzhangyong commented 3 years ago

看一下 管理平台上面 配置模板里面 package_max_length 的配置是多少,加大是否可以解决。 不是数据太大,导致swoole 无法正常收包

wx1860 commented 3 years ago

package_max_length 这个我已经在模板里配置了10M,并且重启了服务,还是没能接到数据