LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-22-2024, 04:14 PM   #1
ChazJ
LQ Newbie
 
Registered: May 2024
Posts: 2

Rep: Reputation: 0
Angry TCP/IP recv() returns zero bytes (EOF) with no FIN from Peer


Normally on a TCP/IP peer-peer connection, a connection is terminated by one side sending a FIN packet. This is reported to the other side by a return from a blocking call to recv() indicating zero bytes received (EOF).

Our application is running on RedHat 7.4 and establishes permanent TCP/IP connections to another system. During normal traffic flow, it will occasionally disconnect from the peer for no apparent reason. Investigation showed that the blocking call to recv() returns zero bytes (EOF) which causes the code to shutdown and close the socket. However, Wireshark traces confirm that the peer did NOT send a FIN or RST to end the session.

Under what other conditions can the kernel TCP/IP stack return zero bytes from a recv() call during a normal, stable session?
 
Old 05-23-2024, 05:32 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,347

Rep: Reputation: Disabled
Could it be that an RST is sent by an intermediate router? Due to NAT/firewall idle TCP timeout?
 
Old 05-28-2024, 09:29 AM   #3
ChazJ
LQ Newbie
 
Registered: May 2024
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Ser Olmy View Post
Could it be that an RST is sent by an intermediate router? Due to NAT/firewall idle TCP timeout?
Thanks for your response.

Wireshark traces at the interface of the client system show no FIN or RST coming from the other side. What we see is this (10.59.150.179 is our client system):

No. Time Source Destination Protocol Length Info
48883 2024-05-05 09:35:58.457479 10.59.150.179 10.15.50.27 TCP 347 53450 → 4803 [PSH, ACK] Seq=574894 Ack=381957 Win=63270 Len=293
48884 2024-05-05 09:35:58.466093 10.15.50.27 10.59.150.179 TCP 60 4803 → 53450 [ACK] Seq=381957 Ack=575187 Win=14946 Len=0
48888 2024-05-05 09:35:58.487998 10.59.150.179 10.15.50.27 TCP 369 53450 → 4803 [PSH, ACK] Seq=575187 Ack=381957 Win=63270 Len=315
48889 2024-05-05 09:35:58.496546 10.15.50.27 10.59.150.179 TCP 60 4803 → 53450 [ACK] Seq=381957 Ack=575502 Win=14631 Len=0
48899 2024-05-05 09:35:58.533152 10.59.150.179 10.15.50.27 TCP 711 53450 → 4803 [PSH, ACK] Seq=575502 Ack=381957 Win=63270 Len=657
48902 2024-05-05 09:35:58.541768 10.15.50.27 10.59.150.179 TCP 60 4803 → 53450 [ACK] Seq=381957 Ack=576159 Win=13974 Len=0
48972 2024-05-05 09:35:58.811536 10.15.50.27 10.59.150.179 TCP 712 4803 → 53450 [PSH, ACK] Seq=381957 Ack=576159 Win=15876 Len=658
48973 2024-05-05 09:35:58.811557 10.59.150.179 10.15.50.27 TCP 54 53450 → 4803 [ACK] Seq=576159 Ack=382615 Win=63270 Len=0
<At this point our client application's socket get a zero byte return from a recv() call, which causes it to close the connection>
48974 2024-05-05 09:35:58.815989 10.59.150.179 10.15.50.27 TCP 54 53450 → 4803 [FIN, ACK] Seq=576159 Ack=382615 Win=63270 Len=0
48975 2024-05-05 09:35:58.816003 10.59.150.179 10.15.50.27 TCP 54 53450 → 4803 [RST, ACK] Seq=576160 Ack=382615 Win=63270 Len=0

Why would the tcpip stack do this without any FIN or RST from the other side?
 
Old 05-28-2024, 08:34 PM   #4
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,860

Rep: Reputation: 162Reputation: 162
> At this point our client application's socket get a zero byte return from a recv() call, which causes it to close the connection
Your client might send out too short TCP packet.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Samba: 2317 - Call returned zero bytes (EOF) tungvs Linux - Server 0 06-14-2008 02:23 PM
recv returning sucess after the peer client is killed? Santoshkb Linux - Networking 1 01-14-2008 07:36 AM
Urgent---TSclient Problem -Error: recv:Connection Reset by Peer? teluguswan Linux - Networking 5 10-12-2007 01:52 AM
samba: session setup failed: Call returned zero bytes (EOF) theYinYeti Linux - Server 2 09-13-2007 06:37 AM
calling sys_read inside sys_write returns number of bytes read as zero appas Linux - Software 0 08-28-2004 07:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration