mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #3527] Documentation of frps.ini TCPKeepAlive/tcp_keepalive incorrect #2815
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#2815
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 @delaneyb on GitHub (Jul 12, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3527
Bug Description
Based on tracing the use of
TCPKeepAlivethrough tohandleConnin github.com/fatedier/golib/net/mux, it appears that the comparison actually performed to decide whether to calltcpConn.SetKeepAlivePeriodisif mux.keepAlive != 0, which contradicts the frps_full example, and the explanation in comments in server.go, which say that using a negative value for this setting in your config will disable tcp_keepalive probes.According to pkg.go.dev, to explicitly disable keepalives on a Go TCPConn, we need to use
SetKeepAlive(false)frpc Version
0.48.0
frps Version
0.48.0
System Architecture
arm client/amd64 server
Configurations
frps.ini:
tcp_mux_keepalive_interval = 120
tcp_keepalive = -1
frpc.ini:
tcp_mux_keepalive_interval = 7200
dial_server_keepalive = 300
Logs
No response
Steps to reproduce
No response
Affected area
@fatedier commented on GitHub (Jul 12, 2023):
Have you tried set it to -1? I don't remember very clearly, but I should have tested this usage.
@delaneyb commented on GitHub (Jul 16, 2023):
Apologies for confusion, I have just tested with it set to -1 and 0 against
netstat --timers. With a value of -1, it does in fact disable keepalives altogether. With a value of 0, it uses the go TCPConn default of 15 secondsI must be misunderstanding what is getting called, or the syscall that I think is getting called when passed a negative duration just turns off keepalives for the socket
@delaneyb commented on GitHub (Jul 16, 2023):
I was testing the above with frpc for the setting
dial_server_keepaliverunning onLinux yb-4 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/LinuxHowever, for frps on
Linux frps 5.13.0-1023-gcp #28~20.04.1-Ubuntu SMP Wed Mar 30 03:51:07 UTC 2022 x86_64 Linux, whethertcp_keepaliveis set to 0 or 1, it uses the Go default of 15sCaptures on both server and client:
frpc.ini
@fatedier commented on GitHub (Jul 17, 2023):
I found that the behavior of this action varies on different operating systems. It would be better to explicitly specify
SetKeepAlive(false).