mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #1867] [Question] About the "fake" ACK sent by frps #1475
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#1475
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 @database64128 on GitHub (Jun 18, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/1867
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.32.1What operating system and processor architecture are you using (
go env)?Configures you used:
TCP
Steps to reproduce the issue:
frpcclient to redirect a remote service tofrps's port 7016.frps's port 7016.frpcand the remote service is broken for some reason. All packets sent fromfrpcto the remote service are dropped/timed-out without anyACKfrom the remote service.Describe the results you received:
The TCP connection between the service client and
frpsis still established. Because upon receiving a[PSH, ACK]packet from the service client,frpsimmediately sends anACK, making the service client think the connection is still alive, whereas in fact, the connection betweenfrpcand the remote service is already dead. The service client, in my case isssh, hangs forever because of this.Describe the results you expected:
frpsimmediately responds with anACKupon receiving an[PSH, ACK]packet? Shouldn't it just relay theACKcoming from the remote service?frpsjust blindly responds with anACK, even if the remote service is no longer reachable.ACKimmediately is justified, I would expect it to detect if the connection betweenfrpcand the remote service is still alive, and close the connection if noACKor any packets are coming from the remote service. Or just do its job of relaying TCP packets, and don't respond withACKon its own.Additional information you deem important (e.g. issue happens only occasionally):
The above statements and conclusions are backed by WireShark captures.
Can you point out what caused this issue (optional)
frpsblindly responds with anACKas soon as it received transmission from the service client.@fatedier commented on GitHub (Jun 19, 2020):
I'm not sure i have already understand your problem. Can you point out the releated code?
Do you mean that connection between your ssh client and frps is ok when connection between frpc and your ssh service is broken?
There are different situation:
local_ipbut no route to it, frpc will always try to dial to it until you cancel your client connection or timeout.What's your situation?
@database64128 commented on GitHub (Jun 20, 2020):
I'm not familiar with Golang 😅.
Yes.
Case 3 would best describe my situation.
This is how a typical SSH connection looks like: Press a key in the terminal. The SSH client sends packet 1. The server sends packet 2 to update the texts in the terminal. And finally an
ACKfrom the client.If the network is broken for some reason, you would only see packet 1. Then the SSH connection would timeout after 30 seconds without any response from the server.
And this is how it looks like when the SSH client connects to a
sshdport forwarded byfrps. When you press a key in the terminal, the SSH client sends packet 1. Thenfrpsimmediately responds with anACK. But the actual response fromsshdonly comes in packet 3.When the network between
frpcand the remotesshdis broken:frpcside, it couldn't receive any packet from the remote service.frpsside,frpscontinues responding anyPSHpacket from the SSH client with anACK. Because the SSH client still receives these "fake"ACKpackets, it thinks the connection is intact, so it wouldn't trigger the timeout mechanism. But no actual data coming from the server means it can't update anything in the terminal, causing the terminal to freeze forever. In this case when capturing packets, you would only see packet 1 and packet 2. This behavior offrpssendingACKon its own is causing the problem.@fatedier commented on GitHub (Jun 20, 2020):
The problem is
frpccan't detect the network error like this. TCP socket won't return error.Try this heatlh check to solve the problem?
If network between sshd service and frpc has error, frps will close your ssh connections.
@database64128 commented on GitHub (Jun 21, 2020):
Thanks for the suggestion!