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"><<a href="mailto:tlee@redhat.com">tlee@redhat.com</a>></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 <<a href="mailto:virat.gohil@gmail.com">virat.gohil@gmail.com</a>> wrote:<br>
> Hi All,<br>
><br>
> <>Please ignore the first message, it is incomplete<><br>
><br>
> I am getting the following exception in my server logs after about 2-3<br>
> minutes of uptime. Please help me in indentifying the solution for<br>
> this issue:<br>
><br>
> ///////Start of logging<br>
> 29 Apr 2009 16:17:30:021 ERROR [pool-3-thread-18] root -<br>
> java.lang.IllegalStateException: Internal error<br>
> 29 Apr 2009 16:17:30:022 ERROR [pool-3-thread-18] root - at<br>
> com.sun.net.ssl.internal.ssl.SSLEngineImpl.initHandshaker(Unknown<br>
> Source)<br>
> 29 Apr 2009 16:17:30:022 ERROR [pool-3-thread-18] root - at<br>
> com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(Unknown Source)<br>
> 29 Apr 2009 16:17:30:022 ERROR [pool-3-thread-18] root - at<br>
> com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(Unknown<br>
> Source)<br>
> 29 Apr 2009 16:17:30:022 ERROR [pool-3-thread-18] root - at<br>
> com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(Unknown Source)<br>
> 29 Apr 2009 16:17:30:023 ERROR [pool-3-thread-18] root - at<br>
> javax.net.ssl.SSLEngine.unwrap(Unknown Source)<br>
> 29 Apr 2009 16:17:30:023 ERROR [pool-3-thread-18] root - at<br>
> org.jboss.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:699)<br>
> 29 Apr 2009 16:17:30:023 ERROR [pool-3-thread-18] root - at<br>
> org.jboss.netty.handler.ssl.SslHandler.decode(SslHandler.java:445)<br>
> 29 Apr 2009 16:17:30:024 ERROR [pool-3-thread-18] root - at<br>
> org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:270)<br>
> 29 Apr 2009 16:17:30:024 ERROR [pool-3-thread-18] root - at<br>
> org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:210)<br>
> 29 Apr 2009 16:17:30:024 ERROR [pool-3-thread-18] root - at<br>
> org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:87)<br>
> 29 Apr 2009 16:17:30:025 ERROR [pool-3-thread-18] root - at<br>
> org.jboss.netty.handler.codec.frame.FrameDecoder.handleUpstream(FrameDecoder.java:170)<br>
> 29 Apr 2009 16:17:30:025 ERROR [pool-3-thread-18] root - at<br>
> org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:342)<br>
> 29 Apr 2009 16:17:30:025 ERROR [pool-3-thread-18] root - at<br>
> org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:329)<br>
> 29 Apr 2009 16:17:30:025 ERROR [pool-3-thread-18] root - at<br>
> org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:299)<br>
> 29 Apr 2009 16:17:30:026 ERROR [pool-3-thread-18] root - at<br>
> org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:254)<br>
> 29 Apr 2009 16:17:30:026 ERROR [pool-3-thread-18] root - at<br>
> org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:176)<br>
> 29 Apr 2009 16:17:30:026 ERROR [pool-3-thread-18] root - at<br>
> org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:49)<br>
> 29 Apr 2009 16:17:30:027 ERROR [pool-3-thread-18] root - at<br>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)<br>
> 29 Apr 2009 16:17:30:027 ERROR [pool-3-thread-18] root - at<br>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)<br>
> 29 Apr 2009 16:17:30:027 ERROR [pool-3-thread-18] root - at<br>
> java.lang.Thread.run(Unknown Source)<br>
> /////////end of logging<br>
><br>
> I am not sure, but It looks like messageReceived is fired before<br>
> SSLHandshake is finished.<br>
><br>
> Some more information:<br>
> 1. I am doing some DB operation in my channelConnected method (p.s.<br>
> the operation are done within the FutureListener).<br>
> 2. I am using Netty 3.1 Beta 2.<br>
> 3. JDK 1.5.0_11, Solaris 10 on a SPARC system.<br>
><br>
> My handler.channelConnected() looks something like below:<br>
><br>
> public void channelConnected(...)<br>
> {<br>
> // get SSLHandshake furure = handshakeFuture<br>
> handshakeFuture.addListener(new ChannelFutureListener(){<br>
> public void operationComplete(...){<br>
> if(isNodePresentInDB())<br>
> //accept the connection and add the channel to channel group<br>
> else if(isConnectionFromLocalInterface())<br>
> // accept the connection and add channel to channel group<br>
> else<br>
> //connection is from a invalid node, ignore the connection and<br>
> close the channel.<br>
> }<br>
><br>
> 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'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>