mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #1289] 高并发、大流量场景下出现断流和 404 错误 #1018
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#1018
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kasuganosoras on GitHub (Jun 15, 2019).
Original GitHub issue: https://github.com/fatedier/frp/issues/1289
Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly.
(为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。)
Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST
What version of frp are you using (./frpc -v or ./frps -v)?
0.17.0
What operating system and processor architecture are you using (
go env)?Frps 与 Frpc 操作系统均为 CentOS 7.6 Linux amd64
Frps 服务器:L5630 * 2,32GB,1Gbps Uplink
Fpc 服务器:E5-2698 v3,64GB,100Mbps Uplink
Configures you used:
Frps:
Frpc:
Steps to reproduce the issue:
Describe the results you received:
下载断流,网页访问出现 404 错误,客户端日志出现错误:
Describe the results you expected:
正常工作
Additional information you deem important (e.g. issue happens only occasionally):
这个问题是线上环境出现的,每分钟请求量大概在 1500 左右,单日流量大约在 3.5TB 左右,客户端就会频繁出现
work connection closed, EOF错误。出现故障时 Frps 与 Frpc 的系统负载均正常(CPU、内存、硬盘读写),测试过使用 HaProxy 作为最外层直接反代后端 Nginx,当并发数量达到 2 万时机器依然能够正常响应请求,基本上可以排除是机器配置不够导致的问题。
尝试过在另一台服务器上使用 CC 压力测试工具对 http 映射进行压力测试,当每分钟请求数量达到 2000 时也会出现这个问题。
由于对客户端进行了二次开发,可能暂时没有办法升级到最新版本的 Frp,目前使用的版本依然是 0.17.0,希望能够在不改变版本的情况下修复问题 :)
Can you point out what caused this issue (optional)
猜测可能是 TCP_MUX 造成的,尝试过关闭这个功能,但是效果并不明显
@fatedier commented on GitHub (Jun 16, 2019):
work connection closed, EOF这是用户连接断开的正常日志,不一定是错误日志。@kasuganosoras commented on GitHub (Jun 16, 2019):
感谢回复,以下是一些补充:
work connection closed, EOF我想知道的是问题出在了哪一层,是 Frps 还是 Frpc

@fatedier commented on GitHub (Jun 17, 2019):
work connection closed, EOF这是用户连接断开的正常日志,不一定是错误日志。@kasuganosoras commented on GitHub (Jun 26, 2019):
这两天报错又变了,这是客户端的报错
这是服务端的
带来的情况就是访问时出现 Frps 404 错误页的次数更多,现在网站基本处于崩溃状态
我现在一个 Frps 大概带了700-800 个客户端左右,难道是客户端太多?
@fatedier commented on GitHub (Jun 26, 2019):
这个取决于你的带宽,以及这么多客户端的活跃程度,还有这个是和你配置的代理的数量是相关的,一个客户端配置了很多代理也是有一定影响的。
@kasuganosoras commented on GitHub (Aug 3, 2019):
经过了我一个月的研究,我终于搞清楚这个原因了,原来我的业务架构是 NGINX + php-fpm,因为使用了 HTTP/2,所以会建立大量的长连接,而由于 php-fpm 的性能不足,出现了很多没有及时关闭的连接,最终连接数量越来越多,把 Frps 服务端都拖垮了。
现在我用 Swoole 重写了后端业务代码,回到了 HTTP/1.0(因为对应软件是轮询,没有必要做长连接),再进行了一次高并发请求测试,在 2000 线程 + 512 连接的情况下 Frps 依然毫无压力,可以证明就是因为连接数过多导致的这个错误了。
最后,非常感谢作者的帮助,谢谢 :)
@fatedier commented on GitHub (Aug 3, 2019):
@kasuganosoras 研究精神值得称赞。👍
长连接本身没什么问题,问题就在于,也许可以根据业务场景设置合适的空闲超时时间,超过的话就释放。否则,短连接轮询的方式,增加了一些成本,在 QPS 过高的情况下,可能会有大量 TIME_WAIT 的连接,也容易出问题。
@minringcheng commented on GitHub (Jan 1, 2021):
我也出现了这个问题,0.34.3,我都看不懂上面的这位怎么解决的,我太菜了
@minringcheng commented on GitHub (Jan 1, 2021):
另外测试时没用http/2也会出现断流的问题,随便一压测就断流,也是要重启frpc
@minringcheng commented on GitHub (Jan 1, 2021):
断流时日志如下,少量work connection closed before response StartWorkConn message: EOF,然后就是大量的join connections closed,后面是一长串的心跳包发送成功接收成功,这中间没其他日志,网站也不能访问
@fatedier commented on GitHub (Jan 5, 2021):
@qianyuqianhe 有可以方便其他人本地复现的例子吗?
@minringcheng commented on GitHub (Jan 6, 2021):
没有,这是最麻烦的地方,刚刚又出现了,上周末用frp前我还在局域网里压测了一下都是正常的,我得再找找原因,局域网压测的时候是http,线上是http2的https,这是一个区别,结合上面老哥讲的,准备从这边着手分析下