[GH-ISSUE #1931] 希望能提供选项, 在客户端初次连接失败时, 进行稳妥的重连 #1533

Closed
opened 2026-05-05 12:58:11 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @yyjdelete on GitHub (Aug 3, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/1931

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.

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.33.0

What operating system and processor architecture are you using (go env)?

win10-x64

Configures you used:
纯测试, 开在同一台机器上的
frpc.ini(kcp模式去掉注释即可)

[common]
server_addr = 127.0.0.1
server_port = 7000
;protocol = kcp

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 8888
remote_port = 8889

frps.ini

[common]
bind_port = 7000
# Specify a UDP port for KCP.
kcp_bind_port = 7000

Steps to reproduce the issue:

  1. 在未启动frps或者未连接网络的情况下先启动frpc

Describe the results you received:
TCP: 立即退出, 不会进行重连

2020/08/03 13:55:19 [W] [service.go:101] login to server failed: dial tcp 127.0.0.1:7000: connectex: No connection could be made because the target machine actively refused it.
dial tcp 127.0.0.1:7000: connectex: No connection could be made because the target machine actively refused it.

KCP: 卡死在提示login to server failed: i/o deadline reached之后, Ctrl+C强制退出会出现panic.

2020/08/03 13:49:17 [W] [service.go:101] login to server failed: i/o deadline reached
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x18 pc=0x83f379]

goroutine 35 [running]:
github.com/fatedier/frp/client.(*Control).Close(0x0, 0xe11101, 0xa20101)
        /home/wcl/go_projects/src/github.com/fatedier/frp/client/control.go:184 +0x29
github.com/fatedier/frp/client.(*Service).Close(0xc0001ca000)
        /home/wcl/go_projects/src/github.com/fatedier/frp/client/service.go:297 +0x41
github.com/fatedier/frp/cmd/frpc/sub.handleSignal(0xc0001ca000)
        /home/wcl/go_projects/src/github.com/fatedier/frp/cmd/frpc/sub/root.go:113 +0xcb
created by github.com/fatedier/frp/cmd/frpc/sub.startService
        /home/wcl/go_projects/src/github.com/fatedier/frp/cmd/frpc/sub/root.go:225 +0x226

Describe the results you expected:
客户端和已经连上之后再断开一样, 进行正常的重连(而不是卡死或者立即退出)
(这个对于将frpc作为后台服务稳定的启动起来比较重要, 手工执行的话倒是无所谓)
(tcp/kcp二者对于连上之后退出frps的情况均能正常重连, 主要是初次连接失败后的情况)

Additional information you deem important (e.g. issue happens only occasionally):

Can you point out what caused this issue (optional)

Originally created by @yyjdelete on GitHub (Aug 3, 2020). Original GitHub issue: https://github.com/fatedier/frp/issues/1931 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. 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.33.0 **What operating system and processor architecture are you using (`go env`)?** >win10-x64 **Configures you used:** 纯测试, 开在同一台机器上的 frpc.ini(kcp模式去掉注释即可) ```ini [common] server_addr = 127.0.0.1 server_port = 7000 ;protocol = kcp [ssh] type = tcp local_ip = 127.0.0.1 local_port = 8888 remote_port = 8889 ``` frps.ini ```ini [common] bind_port = 7000 # Specify a UDP port for KCP. kcp_bind_port = 7000 ``` **Steps to reproduce the issue:** 1. 在未启动frps或者未连接网络的情况下先启动frpc 2. 3. **Describe the results you received:** TCP: 立即退出, 不会进行重连 ``` 2020/08/03 13:55:19 [W] [service.go:101] login to server failed: dial tcp 127.0.0.1:7000: connectex: No connection could be made because the target machine actively refused it. dial tcp 127.0.0.1:7000: connectex: No connection could be made because the target machine actively refused it. ``` KCP: 卡死在提示`login to server failed: i/o deadline reached`之后, `Ctrl+C`强制退出会出现panic. ``` 2020/08/03 13:49:17 [W] [service.go:101] login to server failed: i/o deadline reached panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x18 pc=0x83f379] goroutine 35 [running]: github.com/fatedier/frp/client.(*Control).Close(0x0, 0xe11101, 0xa20101) /home/wcl/go_projects/src/github.com/fatedier/frp/client/control.go:184 +0x29 github.com/fatedier/frp/client.(*Service).Close(0xc0001ca000) /home/wcl/go_projects/src/github.com/fatedier/frp/client/service.go:297 +0x41 github.com/fatedier/frp/cmd/frpc/sub.handleSignal(0xc0001ca000) /home/wcl/go_projects/src/github.com/fatedier/frp/cmd/frpc/sub/root.go:113 +0xcb created by github.com/fatedier/frp/cmd/frpc/sub.startService /home/wcl/go_projects/src/github.com/fatedier/frp/cmd/frpc/sub/root.go:225 +0x226 ``` **Describe the results you expected:** 客户端和已经连上之后再断开一样, 进行正常的重连(而不是卡死或者立即退出) (这个对于将frpc作为后台服务稳定的启动起来比较重要, 手工执行的话倒是无所谓) (tcp/kcp二者对于连上之后退出frps的情况均能正常重连, 主要是初次连接失败后的情况) **Additional information you deem important (e.g. issue happens only occasionally):** **Can you point out what caused this issue (optional)**
Author
Owner

@fatedier commented on GitHub (Aug 3, 2020):

https://github.com/fatedier/frp/blob/master/conf/frpc_full.ini#L46

login_fail_exit = false

搜索历史 issue 也可以看到类似的问题。

<!-- gh-comment-id:667826204 --> @fatedier commented on GitHub (Aug 3, 2020): https://github.com/fatedier/frp/blob/master/conf/frpc_full.ini#L46 `login_fail_exit = false` 搜索历史 issue 也可以看到类似的问题。
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#1533
No description provided.