-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[BUG] TCP keep alive sockets not working #16447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Noticed that after the probes receive no reply, the TCP stack calls the abort mechanism indefinitely: [CPU0] [ 2] tcp_timer: aborted
[CPU0] [ 2] tcp_timer: aborting
[CPU0] [ 2] tcp_timer: aborted
[CPU0] [ 2] tcp_timer: aborting
[CPU0] [ 2] tcp_timer: aborted
[CPU0] [ 2] tcp_timer: aborting
[CPU0] [ 2] tcp_timer: aborted
[CPU0] [ 2] tcp_timer: aborting
[CPU0] [ 2] tcp_timer: aborted
[CPU0] [ 2] tcp_timer: aborting
[CPU0] [ 2] tcp_timer: aborted
[CPU0] [ 2] tcp_timer: aborting
[CPU0] [ 2] tcp_timer: aborted
[CPU0] [ 2] tcp_timer: aborting This is net/tcp/tcp_timer.c:704 It appears the mechanism is working, but the networking logic does not remove the connection properly so |
@a-lunev Do you have any ideas what this issue might be? I saw you've made some changes a long time ago to the networking logic, and thought you might now better than me. @gregory-nutt I see that most of the TCP implementation was written by you in 2017. Do you have any idea what may be wrong here, or could you advise me about how to use your |
@wangyingdong I saw you wrote the zero-probe timer support and |
@zhhyu7 I saw you removed the tcp_callback when accepting conn timeout, do you happen to know if that change might have interfered with TCP Keepalive? |
@linguini1 could you test the following patch?
|
Thank you @zhhyu7, this resolved the issue! I am very appreciative of your help. Would you be able to either submit the patch as a PR or would you like me to submit this patch? |
@linguini1 You can submit the PR directly. Thank you very much. |
Thank you! |
The TCP keep-alive implementation would send the probes and abort the connection correctly, but without waking up the affected socket and marking the connection as aborted. This patch from zhhyu7 in apache#16447 resolves the issue. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
The TCP keep-alive implementation would send the probes and abort the connection correctly, but without waking up the affected socket and marking the connection as aborted. This patch from zhhyu7 in #16447 resolves the issue. Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Description / Steps to reproduce the issue
I am having some issues with TCP keep-alive on the W5500-EVB pico. Namely, all the keep-alive socket options can be set nominally (no error from
setsockopt
), but the connection does not reset after the keep-alive time. I am testing this by setting up a connection successfully between two W5500-EVB Picos, and then turning off the client EVB Pico and waiting for the timeout to occur. The timeout never happens (blockingrecv
should return ECONNRESET as it does on Linux, or at least some error code).For testing, I am using 2 probes with an interval of 5 seconds.
This is the code I am using to setup the TCP socket:
And here is the code where I expect to see the timeout:
I have also used Wireshark to listen to the network traffic being sent and I am unable to see any of the probes being sent at all.
On which OS does this issue occur?
[OS: Linux]
What is the version of your OS?
Linux 6.14.7-arch2-1 SMP PREEMPT_DYNAMIC Thu, 22 May 2025 05:37:49 +0000 x86_64 GNU/Linux
NuttX Version
master
Issue Architecture
[Arch: arm]
Issue Area
[Area: Networking]
Host information
No response
Verification
The text was updated successfully, but these errors were encountered: