Menu

#220 Handling TCP hung state

general
open
nobody
TCP (1)
5
2016-09-21
2016-09-21
Karthikeyan
No

I'm trying to use MantaRay library for clustered messaging. While doing some test, found that that MantaRay doesn't handle hung TCP state.

To reproduce the issue,
1. Run the sample application in two machines.
2. Make sure each machine is able to send & receive "keep-alive" messages. Do enable the debug options for network.keep-alive configuration.
3. Unplug the network cable in One of the machine.
4. You can see that the machines are not able to find the other machine's status.

While going through the code, found that the "lastReceived" value from Transport class is updated in two cases. 1 is when writing into the socket channel and 2 is when reading from the socket channel.

When you unplug the cable, the socket channel may not be able to identify the connection is closed. So, it seems like updating the "lastReceived" value when writing into the socket channel causes the issue in this scenario. Commenting out the inside write method (in - TcpTransportImpl.selectWrite method) does helps to handle the hung state and able to identify the node's state when the network cable is unplugged.

Discussion


Log in to post a comment.