8000 RPC Client接收超过64k的数据会丢包 · Issue #316 · swoft-cloud/swoft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

RPC Client接收超过64k的数据会丢包 #316

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

Closed
chongzi5210 opened this issue Jul 16, 2018 · 13 comments
Closed

RPC Client接收超过64k的数据会丢包 #316

chongzi5210 opened this issue Jul 16, 2018 · 13 comments
Labels

Comments

@chongzi5210
Copy link
Q A
Bug report? yes/no
Feature request? yes/no
Swoft version x.y.z
Swoole version x.y.z (by php --ri swoole)
PHP version x.y.z (by php -v)
Runtime environment Win10/Mac/CentOS 7/Ubuntu/Docker etc.

Details

Describe what you are trying to achieve and what goes wrong.

// paste output here

Provide minimal script to reproduce the issue

// paste code

image

image

image

image

@chongzi5210
Copy link
Author

使用下载下来的demoService 可以做测试, getUser 直接返回数据 64k 以内可以正常返回 超过64k会报错

@inhere inhere added the bug label Jul 16, 2018
@inhere
Copy link
Member
inhere commented Jul 16, 2018

你配置的包最大长度是多少?

8000

@huangzhhui
Copy link
Contributor

eof_split也要为true,确保分包没问题

@chongzi5210
Copy link
Author

demo.zip

具体配置都配了 我下载的你们的包 在里面验证了也是一样 我把包发上来你们看看

swoole

swoole support => enabled
Version => 4.0.1
Author => tianfeng.han[email: mikan.tenny@gmail.com]
coroutine => enabled
kqueue => enabled
rwlock => enabled
async redis client => enabled
async http/websocket client => enabled
sockets => enabled
openssl => enabled
pcre => enabled
zlib => enabled
jemalloc => enabled
debug => enabled

Directive => Local Value => Master Value
swoole.aio_thread_num => 2 => 2
swoole.display_errors => On => On
swoole.use_namespace => On => On
swoole.use_shortname => On => On
swoole.fast_serialize => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608

@huangzhhui
Copy link
Contributor

@chongzi5210 请使用最新版的 swoft 项目,并将组件更新至最新版测试,demo 缺少一下配置

'open_eof_split'     => env('TCP_OPEN_EOF_SPLIT', true),
'package_eof'        => "\r\n",

image

@chongzi5210
Copy link
Author

image

这两个参数都有的 我都测试过
发现这个问题之后,我看了swoole 相关的文档说明, 设置了open_eof_check open_eof_split package_eof 我上传的那个包里面这几个参数都没设置吗? 感觉参数没其作用不知道啥原因

@chongzi5210
Copy link
Author

image

@huangzhhui
Copy link
Contributor

你的包里面压根没有 open_eof_split package_eof,请使用最新版的Swoft并保留open_eof_check open_eof_split package_eof参数为默认值再试

@chongzi5210
Copy link
Author

可能我打包搞错了 我确实添加了这些参数 测试了的 而且你说了之后我又检查了 设置后测试还是一样的
你用我上传的包 添加那几个参数后是正常的???

@chongzi5210
Copy link
Author

十分喜欢这个框架 也感谢你们做出这么优秀的东西 如果我打的包里面没有带上这两个参数是我的失误, 我道歉。 但是请不要怀疑我的智商。 打包问题是因为我有个项目用这个框架做的, 发现问题不好打包那个项目, 所以从下载了干净的包,添加了点测试代码, 可能转过来的时候漏掉了。

刚刚我特意搞了个新环境 composer 重新拉了代码, 检查了参数,结果依然。 如果你们确认没有问题,那就当我傻逼吧,请关闭我的问题

@huangzhhui
Copy link
Contributor

收包分包都是Swoole来完成的,只要相关的参数被正确的配置进去,请参考 https://wiki.swoole.com/wiki/page/421.html

@songweihang
Copy link
songweihang commented Jul 30, 2018

@chongzi5210
我们发现这个问题,你不想等官方更新的话,你可以在
rpc-client 这个包里面的
ServiceConnection 这个协程客户端的createConnection方法修改

$client = new Client(SWOOLE_SOCK_TCP | SWOOLE_KEEP);
$client->set([
'open_eof_split' => true,
'open_eof_check' => false,
'package_eof' => "\r\n\r\n",
'package_max_length' => 1024 * 1024 * 2,
]);

这个代码即可,主要swoft 中的rpc-client 漏掉了粘包过程

@huangzhhui
Copy link
Contributor

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

No branches or pull requests

4 participants
0