Bug-590: Packet loss on first time ping test 74/6674/2
authorFlavio Fernandes <ffernand@redhat.com>
Sun, 4 May 2014 01:44:34 +0000 (21:44 -0400)
committerFlavio Fernandes <ffernand@redhat.com>
Tue, 6 May 2014 14:33:24 +0000 (10:33 -0400)
commita167683d9e43c6c2986bdf283c8af6e793143990
tree8c40fc2bd24b5a49af81661aad2540073ae276de
parent02e3bf52dc3c0fe8f4c87a170419926ee6d72f33
Bug-590: Packet loss on first time ping test

In this commit, we are addressing a race that could cause the exception (ie first ip packet) to
be lost. What is observed with this bug is that the non-arp packet -- in this case the icmp packet --
is being 'exceptioned' to the SimpleForwarding code path because the node has not yet been programmed
with a flow that would cause it to forward the packet to its destination w/out involving the controller.

The race in this case is caused by Simpleforwarding handling the packet before HostTracker is fully aware
of the destination host. In such case, the forwarding fails to determine where to send the packet and drops it.

The proposed change in this commit takes a stab at handling the race by keeping the packet until either
1) the destination is known by HostTracker or 2) a max time expires. In order to accomplish that, the change
includes the creation of a thread that will periodically age out any packet that have been pending for too
long. The change also adds a concurrent map for efficient lookup among the pending packets. There is a
limitation in this implementation: it will keep at most 1 packet pending per destination ip address. This is
believed not to be a problem, because of the short amount of time it takes for hostTracker to learn about the
destination after the packet is put int the pending map.

Change-Id: I7ec1de69f7841eb7ca5603715b54685be9781401
Signed-off-by: Flavio Fernandes <ffernand@redhat.com>
opendaylight/samples/simpleforwarding/src/main/java/org/opendaylight/controller/samples/simpleforwarding/internal/SimpleForwardingImpl.java