IllegalStateException during unwrap.

Virat Gohil virat4lug at gmail.com
Sun May 3 01:37:37 EDT 2009


Hi Trustin,

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.

My bad, I didnt reply to this message cause I thought it did not make it to
the list.

Thanks,

Virat


On Thu, Apr 30, 2009 at 4:14 PM, Trustin Lee <tlee at redhat.com> wrote:

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


More information about the netty-users mailing list