Howdy :)<div><br></div><div>I have a service that currently listens on thousands of tcp and udp ports (for different channels of data); due to various problems, I am rewriting it in Java and decided to use Netty.</div><div>
<br></div><div>I&#39;ve tried a few different ways of doing things -</div><div><br></div><div>First, one NioServerSocketChannelFactory (or NioDatagramChannelFactory) per listening port. Problem is, after a few thousand server channels (via ConnectionlessBootstrap and ServerBootstrap), I get OOM while creating threads.</div>
<div><br></div><div>Second, one NioServerSocketChannelFactory shared across all TCP server ports and one NioDatagramChannelFactory for all UDP server ports. Problem here is that after about a few hundred open sockets with error &quot;org.jboss.netty.channel.ChannelException: Failed to bind to: /<a href="http://0.0.0.0:15725">0.0.0.0:15725</a>&quot; - watching strace shows bind(2) successfully bind on this port, for example, so the cause is not a bind specific failure. Trolling the logs, I see about 911 successful TCP server sockets before tcp fails with this message</div>
<div><br></div><div>I am using NioServerSocketChannelFactory with Executors.newCachedThreadPool().</div><div><br></div><div>I can try to make some standalone code that reproduces this behavior for further study, but if there&#39;s anything obvious I&#39;m missing, please let me know.</div>
<div><br></div><div>-Jordna</div>