I think the interesting thing is not the thread count. Its the count of th active threads...<br><br>bye<br>norman<br><br>Am Donnerstag, 6. Oktober 2011 schrieb irwinbilling &lt;<a href="mailto:irwin.billing@gmail.com">irwin.billing@gmail.com</a>&gt;:<br>
&gt; Terrible mistake.  I had a loose connection to the database for every client<br>&gt; that wasn&#39;t getting closed.  The problem seems to have disappeared.<br>&gt; Although, threads continue to be made.  I tried connecting clients until the<br>
&gt; thread count reached 90 (the connections were all closed explicitly).  Is<br>&gt; this normal behavior?<br>&gt;<br>&gt; Thanks,<br>&gt; Irwin<br>&gt;<br>&gt;<br>&gt; Norman Maurer-2 wrote:<br>&gt;&gt;<br>&gt;&gt; Are you 100 % sure you are not calling it ? With a database lookup in<br>
&gt;&gt; place you will need to use an ExecutionHandler to offload the task as<br>&gt;&gt; otherwise you will block your IO-Thread.<br>&gt;&gt;<br>&gt;&gt; Maybe you could also attach an thread-dump (via jstack) and show use<br>
&gt;&gt; how your ChannelPipelineFactory implementations looks like.<br>&gt;&gt;<br>&gt;&gt; Bye,<br>&gt;&gt; Norman<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; 2011/10/5 irwinbilling &amp;lt;irwin.billing@&amp;gt;:<br>&gt;&gt;&gt; The handleUserSearch method performs a simple database search and writes<br>
&gt;&gt;&gt; the<br>&gt;&gt;&gt; result to the given channel.  I do not call the method during my tests.<br>&gt;&gt;&gt;  I<br>&gt;&gt;&gt; only call logout.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Norman Maurer-2 wrote:<br>
&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; What does handleUserSearch((MessageUserSearch) message, channel); do ?<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; 2011/10/4 irwinbilling &amp;lt;irwin.billing@&amp;gt;:<br>&gt;&gt;&gt;&gt;&gt; Code:<br>
&gt;&gt;&gt;&gt;&gt; public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)<br>&gt;&gt;&gt;&gt;&gt; {<br>&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;                Message message_new = (Message) e.getMessage();<br>
&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;                if (message instanceof MessageLogout) {<br>&gt;&gt;&gt;&gt;&gt;                        logout((MessageLogout) message);<br>&gt;&gt;&gt;&gt;&gt;                } else if (message instanceof MessageUserSearch) {<br>
&gt;&gt;&gt;&gt;&gt;                        handleUserSearch((MessageUserSearch) message,<br>&gt;&gt;&gt;&gt;&gt; channel);<br>&gt;&gt;&gt;&gt;&gt;                }<br>&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;                super.handleMessage(message, channel);<br>
&gt;&gt;&gt;&gt;&gt;        }<br>&gt;&gt;&gt;&gt;&gt; public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent<br>&gt;&gt;&gt;&gt;&gt; e)<br>&gt;&gt;&gt;&gt;&gt;                        throws Exception {<br>
&gt;&gt;&gt;&gt;&gt;                if (channel != null) {<br>&gt;&gt;&gt;&gt;&gt;                channel.getCloseFuture().removeListener(remover);<br>&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;                channel.close();<br>
&gt;&gt;&gt;&gt;&gt;                }<br>&gt;&gt;&gt;&gt;&gt;                super.channelClosed(ctx, e);<br>&gt;&gt;&gt;&gt;&gt;        }<br>&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt; &quot;channel&quot; is a cached Channel for this connection.  Could holding onto<br>
&gt;&gt;&gt;&gt;&gt; a<br>&gt;&gt;&gt;&gt;&gt; channel reference be causing this.<br>&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt; 2011/10/4 irwinbilling &amp;lt;irwin.billing@&amp;gt;:<br>&gt;&gt;&gt;&gt;&gt;&gt; Hello,<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt; I seem to be running into a very peculiar problem.  Using the default<br>&gt;&gt;&gt;&gt;&gt;&gt; ChannelFactory (Executors.newCachedThreadPool()) with a custom<br>&gt;&gt;&gt;&gt;&gt;&gt; ChannelPipeline, the server seems to stop serving new connections<br>
&gt;&gt;&gt;&gt;&gt;&gt; after<br>&gt;&gt;&gt;&gt;&gt;&gt; 39<br>&gt;&gt;&gt;&gt;&gt;&gt; successful connections and message exchanges.<br>&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt; When looking at the list of running threads, it seems that for every<br>
&gt;&gt;&gt;&gt;&gt;&gt; new<br>&gt;&gt;&gt;&gt;&gt;&gt; connection, a new thread is started.  When the channel disconnects,<br>&gt;&gt;&gt;&gt;&gt;&gt; the<br>&gt;&gt;&gt;&gt;&gt;&gt; thread stays alive (waiting at Unsafe.park).  This happens until the<br>
&gt;&gt;&gt;&gt;&gt;&gt; 40th<br>&gt;&gt;&gt;&gt;&gt;&gt; connection when the CHannelFactory.getPipeline() does not get called.<br>&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt; What could cause an issue of this sort?<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt; Thanks!<br>&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt; --<br>&gt;&gt;&gt;&gt;&gt;&gt; View this message in context:<br>&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Threads-New-Connections-tp6859861p6859861.html">http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Threads-New-Connections-tp6859861p6859861.html</a><br>
&gt;&gt;&gt;&gt;&gt;&gt; Sent from the Netty User Group mailing list archive at Nabble.com.<br>&gt;&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>&gt;&gt;&gt;&gt;&gt;&gt; netty-users mailing list<br>
&gt;&gt;&gt;&gt;&gt;&gt; netty-users@.jboss<br>&gt;&gt;&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-users">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>&gt;&gt;&gt;&gt;&gt; netty-users mailing list<br>&gt;&gt;&gt;&gt;&gt; netty-users@.jboss&lt;View this message in context: <a href="http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Threads-New-Connections-tp6859861p6867246.html">http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Threads-New-Connections-tp6859861p6867246.html</a><br>
&gt; Sent from the Netty User Group mailing list archive at Nabble.com.<br>&gt;<br>&gt; _______________________________________________<br>&gt; netty-users mailing list<br>&gt; <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/netty-users">https://lists.jboss.org/mailman/listinfo/netty-users</a>