Hi Trustin,<br><br>
It turned out to be an issue with my code. somewhere, a read was being performed before the SSL handshake was completed. Basically, it was a race condition. I avoided the race condition by setting a flag in the channelConnected.futureListener.operationComplete() so that nobody else would read before the SSLHandshake was complete.<br>
<br>My bad, I didnt reply to this message cause I thought it did not make it to the list.<br><br>Thanks,<br><br>Virat<br><br><br><div class="gmail_quote">On Thu, Apr 30, 2009 at 4:14 PM, Trustin Lee <span dir="ltr">&lt;<a href="mailto:tlee@redhat.com">tlee@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">On Wed, Apr 29, 2009 at 8:13 PM, Virat Gohil &lt;<a href="mailto:virat.gohil@gmail.com">virat.gohil@gmail.com</a>&gt; wrote:<br>

&gt; Hi All,<br>
&gt;<br>
&gt; &lt;&gt;Please ignore the first message, it is incomplete&lt;&gt;<br>
&gt;<br>
&gt; I am getting the following exception in my server logs after about 2-3<br>
&gt; minutes of uptime. Please help me in indentifying the solution for<br>
&gt; this issue:<br>
&gt;<br>
&gt; ///////Start of logging<br>
&gt; 29 Apr 2009 16:17:30:021 ERROR [pool-3-thread-18]  root -<br>
&gt; java.lang.IllegalStateException: Internal error<br>
&gt; 29 Apr 2009 16:17:30:022 ERROR [pool-3-thread-18]  root -       at<br>
&gt; com.sun.net.ssl.internal.ssl.SSLEngineImpl.initHandshaker(Unknown<br>
&gt; Source)<br>
&gt; 29 Apr 2009 16:17:30:022 ERROR [pool-3-thread-18]  root -       at<br>
&gt; com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(Unknown Source)<br>
&gt; 29 Apr 2009 16:17:30:022 ERROR [pool-3-thread-18]  root -       at<br>
&gt; com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(Unknown<br>
&gt; Source)<br>
&gt; 29 Apr 2009 16:17:30:022 ERROR [pool-3-thread-18]  root -       at<br>
&gt; com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(Unknown Source)<br>
&gt; 29 Apr 2009 16:17:30:023 ERROR [pool-3-thread-18]  root -       at<br>
&gt; javax.net.ssl.SSLEngine.unwrap(Unknown Source)<br>
&gt; 29 Apr 2009 16:17:30:023 ERROR [pool-3-thread-18]  root -       at<br>
&gt; org.jboss.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:699)<br>
&gt; 29 Apr 2009 16:17:30:023 ERROR [pool-3-thread-18]  root -       at<br>
&gt; org.jboss.netty.handler.ssl.SslHandler.decode(SslHandler.java:445)<br>
&gt; 29 Apr 2009 16:17:30:024 ERROR [pool-3-thread-18]  root -       at<br>
&gt; org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:270)<br>
&gt; 29 Apr 2009 16:17:30:024 ERROR [pool-3-thread-18]  root -       at<br>
&gt; org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:210)<br>
&gt; 29 Apr 2009 16:17:30:024 ERROR [pool-3-thread-18]  root -       at<br>
&gt; org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:87)<br>
&gt; 29 Apr 2009 16:17:30:025 ERROR [pool-3-thread-18]  root -       at<br>
&gt; org.jboss.netty.handler.codec.frame.FrameDecoder.handleUpstream(FrameDecoder.java:170)<br>
&gt; 29 Apr 2009 16:17:30:025 ERROR [pool-3-thread-18]  root -       at<br>
&gt; org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:342)<br>
&gt; 29 Apr 2009 16:17:30:025 ERROR [pool-3-thread-18]  root -       at<br>
&gt; org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:329)<br>
&gt; 29 Apr 2009 16:17:30:025 ERROR [pool-3-thread-18]  root -       at<br>
&gt; org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:299)<br>
&gt; 29 Apr 2009 16:17:30:026 ERROR [pool-3-thread-18]  root -       at<br>
&gt; org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:254)<br>
&gt; 29 Apr 2009 16:17:30:026 ERROR [pool-3-thread-18]  root -       at<br>
&gt; org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:176)<br>
&gt; 29 Apr 2009 16:17:30:026 ERROR [pool-3-thread-18]  root -       at<br>
&gt; org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:49)<br>
&gt; 29 Apr 2009 16:17:30:027 ERROR [pool-3-thread-18]  root -       at<br>
&gt; java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)<br>
&gt; 29 Apr 2009 16:17:30:027 ERROR [pool-3-thread-18]  root -       at<br>
&gt; java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)<br>
&gt; 29 Apr 2009 16:17:30:027 ERROR [pool-3-thread-18]  root -       at<br>
&gt; java.lang.Thread.run(Unknown Source)<br>
&gt; /////////end of logging<br>
&gt;<br>
&gt; I am not sure, but It looks like messageReceived is fired before<br>
&gt; SSLHandshake is finished.<br>
&gt;<br>
&gt; Some more information:<br>
&gt; 1. I am doing some DB operation in my channelConnected method (p.s.<br>
&gt; the operation are done within the FutureListener).<br>
&gt; 2. I am using Netty 3.1 Beta 2.<br>
&gt; 3. JDK 1.5.0_11, Solaris 10 on a SPARC system.<br>
&gt;<br>
&gt; My handler.channelConnected() looks something like below:<br>
&gt;<br>
&gt; public void channelConnected(...)<br>
&gt; {<br>
&gt;  // get SSLHandshake furure = handshakeFuture<br>
&gt;  handshakeFuture.addListener(new ChannelFutureListener(){<br>
&gt;  public void operationComplete(...){<br>
&gt;   if(isNodePresentInDB())<br>
&gt;      //accept the connection and add the channel to channel group<br>
&gt;   else if(isConnectionFromLocalInterface())<br>
&gt;    // accept the connection and add channel to channel group<br>
&gt;   else<br>
&gt;      //connection is from a invalid node, ignore the connection and<br>
&gt; close the channel.<br>
&gt; }<br>
&gt;<br>
&gt; Please let me know if any further information is required.<br>
<br>
</div></div>First off, it would be nice if you could upgrade to the latest nightly<br>
build and tell us if the problem is still there.<br>
<br>
If the problem is still there, could you try to reproduce it with the<br>
modified example or something simpler?  I don&#39;t have much clue so far<br>
unfortunately.<br>
<br>
Thanks,<br>
Trustin<br>
<br>
_______________________________________________<br>
netty-users mailing list<br>
<a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
</blockquote></div><br>