Skip to content

WriteListener#abortOnThrowable can't get some error correctly when send request with a new channel #1488

Closed
@spccold

Description

@spccold

WriteListener#abortOnThrowable

 // cause = io.netty.handler.codec.EncoderException: java.lang.NoSuchMethodError: io.netty.buffer.ByteBufUtil.writeShortBE(Lio/netty/buffer/ByteBuf;I)Lio/netty/buffer/ByteBuf;
 // future.getChannelState() = ChannelState.NEW
 // just return false and wait for TimeoutException
 private boolean abortOnThrowable(Channel channel, Throwable cause) {
        if (cause != null && future.getChannelState() != ChannelState.NEW) {
            if (cause instanceof IllegalStateException || cause instanceof ClosedChannelException || StackTraceInspector.recoverOnReadOrWriteException(cause)) {
                LOGGER.debug(cause.getMessage(), cause);
                Channels.silentlyCloseChannel(channel);
            } else {
                future.abort(cause);
            }
            return true;
        }
        return false;
    }

scene:

my application dependent on redisson(with netty 4.1.13.Final) and 
async-http-client-2.1.0-alpha26(with netty 4.1.17.Final),  
but netty 4.1.13.Final is this runtime version(decide by maven arbitration)

result:

get java.util.concurrent.TimeoutException all the time 

rather than get exception: 

io.netty.handler.codec.EncoderException: java.lang.NoSuchMethodError:
io.netty.buffer.ByteBufUtil.writeShortBE(Lio/netty/buffer/ByteBuf;I)Lio/netty/buffer/ByteBuf;

(p.s. writeShortBE first introduced in netty 4.1.14.Final)

Can hava a another more appropriate implementation at here?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions