Netty exception while trying connecting to a switch


Tomer Pearl <Tomer.Pearl@...>
 

Good day everyone,

I’m using Helium release of ODL.

 

I have a mechanism of connection retry while a switch is not available.

Every x seconds I use the OvsdbConnectionService.connect method from org.opendaylight.ovsdb.plugin.api to try to connect to a switch that is unavailable.

After something like 150 retries I receive the following log error:

 

java.lang.IllegalStateException: failed to create a child event loop

        at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:68)[170:io.netty.common:4.0.23.Final]

        at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:49)[169:io.netty.transport:4.0.23.Final]

        at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:61)[169:io.netty.transport:4.0.23.Final]

        at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:52)[169:io.netty.transport:4.0.23.Final]

        at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:44)[169:io.netty.transport:4.0.23.Final]

        at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:36)[169:io.netty.transport:4.0.23.Final]

        at org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService.connect(OvsdbConnectionService.java:92)[191:org.opendaylight.ovsdb.library:1.0.1.Helium-SR1]

        at org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl.connect(ConnectionServiceImpl.java:165)[205:org.opendaylight.ovsdb.plugin:1.0.1.Helium-SR1]

        at com.cxtrm.contexcontrol.ovsdb.impl.OvsdbDao$OvsdbServerImpl.reconnect(OvsdbDao.java:104)[379:com.cxtrm.contexcontrol.ovsdb.impl:1.1.0.0-SNAPSHOT]

        at com.cxtrm.contexcontrol.ovsdb.impl.OvsdbServerPool$1.work(OvsdbServerPool.java:85)[379:com.cxtrm.contexcontrol.ovsdb.impl:1.1.0.0-SNAPSHOT]

        at com.cxtrm.contexmap.fw.scheduler.SchedulerService$RunnableWrapperForWorker.run(SchedulerService.java:102)[355:com.cxtrm.contexmap.common-infrastructure.impl:1.1.0.0-SNAPSHOT]

        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)[:1.7.0_25]

        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)[:1.7.0_25]

        at java.util.concurrent.FutureTask.run(Unknown Source)[:1.7.0_25]

        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)[:1.7.0_25]

        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)[:1.7.0_25]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)[:1.7.0_25]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)[:1.7.0_25]

        at java.lang.Thread.run(Unknown Source)[:1.7.0_25]

Caused by: io.netty.channel.ChannelException: failed to open a new selector

        at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:128)[169:io.netty.transport:4.0.23.Final]

        at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:120)[169:io.netty.transport:4.0.23.Final]

        at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:87)[169:io.netty.transport:4.0.23.Final]

        at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:64)[170:io.netty.common:4.0.23.Final]

        ... 18 more

Caused by: java.io.IOException: Too many open files

        at sun.nio.ch.IOUtil.makePipe(Native Method)[:1.7.0_25]

        at sun.nio.ch.EPollSelectorImpl.<init>(Unknown Source)[:1.7.0_25]

        at sun.nio.ch.EPollSelectorProvider.openSelector(Unknown Source)[:1.7.0_25]

        at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:126)[169:io.netty.transport:4.0.23.Final]

        ... 21 more

 

Even if I try somehow to disconnect from the previous OvsdbClient by calling OvsdbClient.disconnect, I still receive this error.

Is this really a bug or maybe I need to use a different java interface?

 

Thank you very much,

Tomer.