Bug 912382 - SOCK_STREAM TCP: send() returns success even other side responded with RST packet
Summary: SOCK_STREAM TCP: send() returns success even other side responded with RST pa...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-18 15:01 UTC by Tomáš Hozza
Modified: 2013-02-19 15:49 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-02-19 15:49:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Client source (1.65 KB, text/plain)
2013-02-18 15:03 UTC, Tomáš Hozza
no flags Details
Server source (2.42 KB, text/plain)
2013-02-18 15:03 UTC, Tomáš Hozza
no flags Details

Description Tomáš Hozza 2013-02-18 15:01:51 UTC
Description of problem:
I'm using SOCK_STREAM TCP sockets. Imagine server-client application.
- Server will accept connection from client.
- Client sends some data to server -> server receives data.
- Client then half-closes the TCP connection using shutdown(fd, SHUT_WR).
- Client waits for some data from the server.
- Server sends some data to client -> client receives data.
- Client exits and closes the socket.
- After some time server tries to send some data to the client.
- The first send() call returns success even the Client's response is RST.


Version-Release number of selected component (if applicable):
3.7.7-201.fc18.x86_64

How reproducible:
always

Steps to Reproduce:
1. download attached client/server sources.
2. compile server: # gcc tcp_server.c -o server
3. compile client: # gcc tcp_client.c -o client
4. run the server: # ./server
5. run the client: # ./client
  
Actual results:
Server started...
Created SOCK_STREAM socket
Bound to localhost:6666
waiting for connection...
Client connected!
Waiting for some data from client
Received: "MSG from client"
Received EOF
Sending msg to client: "MSG from server"
sleep(5)
Sending 1 msg to client: "MSG from server"
try #1 send() result: (0) Success
Sending 2 msg to client: "MSG from server"
try #2 send() result: (32) Broken pipe
Server exiting...


Expected results:
Server should fail to send() data right after sleep().

Server started...
Created SOCK_STREAM socket
Bound to localhost:6666
waiting for connection...
Client connected!
Waiting for some data from client
Received: "MSG from client"
Received EOF
Sending msg to client: "MSG from server"
sleep(5)
Sending 1 msg to client: "MSG from server"
try #1 send() result: (32) Broken pipe
Server exiting...


Additional info:
RST answer means that data were NOT delivered. Therefore the very
first send() call after server sleep() should fail!

Comment 1 Tomáš Hozza 2013-02-18 15:03:07 UTC
Created attachment 698913 [details]
Client source

Comment 2 Tomáš Hozza 2013-02-18 15:03:31 UTC
Created attachment 698914 [details]
Server source

Comment 3 Tomáš Hozza 2013-02-18 18:19:57 UTC
Still an issue on 3.7.8-202.fc18.x86_64.

Comment 4 Dave Jones 2013-02-18 19:31:57 UTC
can you report this to netdev.org ?  Dealing with the networking developers directly is likely to get your problem fixed a lot faster than us acting as man-in-the-middle here.

Comment 5 Tomáš Hozza 2013-02-19 07:02:33 UTC
(In reply to comment #4)
> can you report this to netdev.org ?  Dealing with the networking
> developers directly is likely to get your problem fixed a lot faster than us
> acting as man-in-the-middle here.

I did. Thank you.

Comment 6 Tomáš Hozza 2013-02-19 15:49:24 UTC
Since send() is not blocking AND send() returning success does not mean
that data were delivered is not a Bug. Closing as NOTABUG.


Note You need to log in before you can comment on or make changes to this bug.