Hi,

I recently got a race condition issue within netty. I am writing a *client* 
library, and in my implementation of "SimpleChannelInboundHandler", I have 
channelRead0() and channelInactive().

My client communicates with a server. The server will close channel if it 
feels something wrong, and what the server does is: 1) send 400 response to 
the client; 2) close the channel.

However, on the client side, there is a rare chance that channelInactive 
gets called before channelRead0 for the last http content. This happens 
rarely, only when the network is extremely good. So my question is: 1) is 
this expected from Netty? 2) how to ensure that channelInactive gets called 
after the last http content is processed?

Thanks,
Ming


Code snippet

@Override
  public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    // *abort request*
  }


@Override
  protected void channelRead0(ChannelHandlerContext ctx, Object msg) {
    // ...
    if (msg instanceof HttpContent) {
      // ...
      if (msg instanceof LastHttpContent) {
        // *complete request*
      }
    }
  }





-- 
You received this message because you are subscribed to the Google Groups 
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netty/2a9ef589-08d8-432c-8066-1ef10d3a94a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to