netty: ctx.writeAndFlush throws BlockingOperationException even channel handler is in separate EventExecutorGroup

Expected behavior

BlockingOperationException only need to be thrown when calling await inside IO thread

Actual behavior

This is exception is thrown even when doing this:

ChannelInitializer(){
      initChannel(...){
           addLast(....)
           addLast(eventExecutorGroup,"businessExecutor", new SimpleChannelInboundHandler(){
                 channelRead0(...){
                        val p = ctx.writeAndFlush(msg)
                        p.await()
                 }  
           })
      }
}

Steps to reproduce

Minimal yet complete reproducer code (or URL to code)

Netty version

4.1.36

JVM version (e.g. java -version)

OS version (e.g. uname -a)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@qeesung I think it is still necessary as you could still end up with a deadlock if another handler that is in from of the handler and uses the same EventExecutorGroup will delay the notification of the promise.