Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wx1860 opened this issue Jan 14, 2021 · 4 comments

Comments

@wx1860
Copy link

wx1860 commented Jan 14, 2021

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
Copy link
Member

dpp2009 commented Jan 15, 2021

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

@wx1860
Copy link
Author

wx1860 commented Jan 24, 2021

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);

服务端实例代码
/**
* @param string $inParam
* @param string $outParam =out=
* @return void
*/
public function uploadFile($inParam,&$outParam);

$inParam接收到是空的

@bobzhangyong
Copy link
Contributor

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

@wx1860
Copy link
Author

wx1860 commented Jan 29, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants