mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #3492] [Feature Request] 希望能增加自动重连 #2791
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#2791
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 @wuai1024 on GitHub (Jun 19, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3492
Describe the feature request
目前遇到得问题就是, 当部署 frpc 的机器,网络波动后,或者断网后恢复网络,就会丢失链接。不会自动去重连 frps
Describe alternatives you've considered
No response
Affected area
@wuai1024 commented on GitHub (Jun 19, 2023):
希望能在 frpc 连接不上 frps 的时候,能间隔5秒去自动发起重连请求。
这个非常重要,很多时候我设置的开机自启,导致网卡都还没连上,frpc就先启动了,然后就连接不上。
@superzjg commented on GitHub (Jun 19, 2023):
请仔细阅读完整配置文件:
首次登录服务器失败后是否退出,默认true,设为false即可
login_fail_exit = false
@wuai1024 commented on GitHub (Jun 19, 2023):
不是这个意思,我目前遇到得问题是。
电脑刚开机的时候,网卡可能还没加载完全,frpc先运行了,就会出现 unknowhosts ,找不到域名的报错,然后就一直会连不上了。
@LuziJay commented on GitHub (Jun 25, 2023):
类似相同的需求,我的情况是出现以下问题:
6月 25 09:18:57 localhost.localdomain frpc[3927643]: 2023/06/25 09:18:57 [I] [service.go:208] [a90a48af75e06642] try to reconnect to server...
6月 25 09:19:07 localhost.localdomain frpc[3927643]: 2023/06/25 09:19:07 [W] [service.go:211] [a90a48af75e06642] reconnect to server error: i/o deadline reached, wait 20>
6月 25 09:19:26 localhost.localdomain frpc[3927643]: 2023/06/25 09:19:26 [I] [service.go:208] [a90a48af75e06642] try to reconnect to server...
6月 25 09:19:36 localhost.localdomain frpc[3927643]: 2023/06/25 09:19:36 [W] [service.go:211] [a90a48af75e06642] reconnect to server error: i/o deadline reached, wait 20>
6月 25 09:19:56 localhost.localdomain frpc[3927643]: 2023/06/25 09:19:56 [I] [service.go:208] [a90a48af75e06642] try to reconnect to server...
6月 25 09:20:06 localhost.localdomain frpc[3927643]: 2023/06/25 09:20:06 [W] [service.go:211] [a90a48af75e06642] reconnect to server error: i/o deadline reached, wait 20>
6月 25 09:20:28 localhost.localdomain frpc[3927643]: 2023/06/25 09:20:28 [I] [service.go:208] [a90a48af75e06642] try to reconnect to server...
6月 25 09:20:38 localhost.localdomain frpc[3927643]: 2023/06/25 09:20:38 [W] [service.go:211] [a90a48af75e06642] reconnect to server error: i/o deadline reached, wait 20>
6月 25 09:21:00 localhost.localdomain frpc[3927643]: 2023/06/25 09:21:00 [I] [service.go:208] [a90a48af75e06642] try to reconnect to server...
6月 25 09:21:10 localhost.localdomain frpc[3927643]: 2023/06/25 09:21:10 [W] [service.go:211] [a90a48af75e06642] reconnect to server error: i/o deadline reached, wait 20>
根据作者的说法是网络问题,但是程序自行重连无法链接,相反,我只需要重启frpc服务即可正常链接(systemctl restart frp)。希望作者能够优化相关重连逻辑
@fatedier commented on GitHub (Jun 25, 2023):
应用层的重试逻辑从日志里已经可以看出来了,如果还是遇到问题,建议需要结合自己的环境仔细排查了,每个人的环境都不一样,无法复现的问题,其他人也很难入手。
就像你问,为什么我的系统死机了,别人一般也很难回答。如果每个问题都要靠开发者去构造各种环境,去排查分析(最关键可能花了大量时间后发现是一个系统配置问题),那靠个人的精力肯定是无法负担的。
提问的成本很低,排查问题,特别是构造异常环境的成本非常高。所以更倾向于,发现问题的同时,自己先做一些分析和资料搜索,以及控制变量的测试验证,能直接提出问题的解决方案更好,或者提供可快速本地复现的方法/环境。
@github-actions[bot] commented on GitHub (Jul 26, 2023):
Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
@Guation commented on GitHub (Jul 30, 2023):
我也遇到了使用tcp映射的时候frpc和frps日志都没有显示断连但是端口已经处于无法连接的状态了 重启frpc就恢复了
@github-actions[bot] commented on GitHub (Aug 30, 2023):
Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
@zcq100 commented on GitHub (Apr 17, 2024):
我也遇到了这个问题。@fatedier
即便设置了loginFailExit=false,frpc依然无法自动连接。手动启动下就能恢复正常。
下面是详细的日志:
设备重启之后,容器是启动的,但是frpc服务始终处于连接被拒绝的状态。
手动重启容器之后,服务恢复正常。
(username@hostname ~)$ podman logs frpc
这是podman生成的启动单元
@shyandsy commented on GitHub (Nov 26, 2025):
v0.65
配置了:loginFailExit = false
复现步骤
@PterX commented on GitHub (Nov 27, 2025):
我也遇到类似情况,我暂时缓解的办法是使用go写了个健康检查程序,访问api/status看下对应的连接状态是不是连接,如果不是连接状态立即重启下frpc。目前能满足大部分保活的需求