Skip to content

Netty server loses exception during handshake #8495

@ejona86

Description

@ejona86

Recently when debugging a server-caused handshake failure, we enabled logs and saw:

Sep 08, 2021 4:56:49 PM io.grpc.netty.shaded.io.grpc.netty.WriteBufferingAndExceptionHandler failWrites
FINE: Ignoring duplicate failure
io.grpc.StatusRuntimeException: UNAVAILABLE: Connection closed while performing protocol negotiation for [FilterChainMatchingProtocolNegotiators$FilterChainMatchingHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]

But there was no earlier failure. This seems to be a problem introduced by the client/server protocol negotiator unification and WriteBufferingAndExceptionHandler. On client-side we issue a fake write (that gets thrown away by NettyClientHandler) and use it for detecting errors during handshake:

channel.writeAndFlush(NettyClientHandler.NOOP_MESSAGE).addListener(new ChannelFutureListener() {

We don't have anything similar on server-side, but WriteBufferingAndExceptionHandler is expecting to communicate a failure via a failed write.

channel.pipeline().addLast(bufferingHandler);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions