Opened 8 years ago

#10814 new Bugs

Boost asio socket keeps established connection forever even after endpoint is closed.

Reported by: Iván <versuchen@…> Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.57.0 Severity: Problem
Keywords: asio established forever blocking Cc:

Description

Context:

Server side:

Accept socket loop blocking read from accepted socket

Client side:

Connect loop blocking write to connected socket

Sporadically the client endpoint is ended but the server is not notified of that event. After that, the client can connect again to the server (even tho gdb says the thread is on recv) but the server never returns from the blocking read due to, probably, the new endpoint sending data doesn't match the last one:

Server side:

Local Address         Foreign Address
192.168.1.1:1234      192.168.1.2:50000

Client side after connection was dropped:

Local Address         Foreign Address
192.168.1.2:50001     192.168.1.2:1234

As I said, the issue is sporadic but I can reproduce the same blocking behaviour as follows:

  1. Run the server and client normally. Client sends data and server reads it.
  2. Enable a traffic filter with a firewall blocking/dropping packages at the client.
  3. After step 2, I can kill the client process and the server will never realize that the client is no longer there, so it will block at recv forever.

Regards, Iván

Change History (0)

Note: See TracTickets for help on using tickets.