Bug 6442: Keepalive not send by BGP ODL 36/44536/1
authorMilos Fabian <milfabia@cisco.com>
Tue, 23 Aug 2016 09:33:02 +0000 (11:33 +0200)
committerMilos Fabian <milfabia@cisco.com>
Tue, 23 Aug 2016 09:33:02 +0000 (11:33 +0200)
When ODL BGP is reading a bigger amount of data using
native epoll transport, scheduled KA hndler task is getting executed.
As a result, remote peer's holdtimer expires -> connection is dropped.

Switch the Epoll mode to "level-triggered", as we want to use MAX_MESSAGES_PER_READ
channel option (round-robin processing).

Ref.: https://netty.io/4.0/api/io/netty/channel/epoll/EpollChannelConfig.html#setEpollMode(io.netty.channel.epoll.EpollMode)

Change-Id: If4a6ac3e3fc9d006cd6ba54c1606731add8bfa2c
Signed-off-by: Milos Fabian <milfabia@cisco.com>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPDispatcherImpl.java

index 674f77a438197f6b9545bede745476d42975a457..96725f7555d417576125a41df1db53bf0a2a107a 100755 (executable)
@@ -20,6 +20,7 @@ import io.netty.channel.EventLoopGroup;
 import io.netty.channel.epoll.Epoll;
 import io.netty.channel.epoll.EpollChannelOption;
 import io.netty.channel.epoll.EpollEventLoopGroup;
+import io.netty.channel.epoll.EpollMode;
 import io.netty.channel.epoll.EpollServerSocketChannel;
 import io.netty.channel.epoll.EpollSocketChannel;
 import io.netty.channel.socket.SocketChannel;
@@ -94,6 +95,7 @@ public class BGPDispatcherImpl implements BGPDispatcher, AutoCloseable {
         final Bootstrap bootstrap = new Bootstrap();
         if (Epoll.isAvailable()) {
             bootstrap.channel(EpollSocketChannel.class);
+            bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED);
         } else {
             bootstrap.channel(NioSocketChannel.class);
         }
@@ -152,6 +154,7 @@ public class BGPDispatcherImpl implements BGPDispatcher, AutoCloseable {
         final ServerBootstrap serverBootstrap = new ServerBootstrap();
         if (Epoll.isAvailable()) {
             serverBootstrap.channel(EpollServerSocketChannel.class);
+            serverBootstrap.childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED);
         } else {
             serverBootstrap.channel(NioServerSocketChannel.class);
         }