From 53e331e0dce06dd6942a9bbac3c6274995047245 Mon Sep 17 00:00:00 2001 From: jrhee17 Date: Wed, 2 Nov 2022 23:18:42 +0900 Subject: [PATCH 1/3] log streaming error --- .../common/AbstractHttp2ConnectionHandler.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/linecorp/armeria/internal/common/AbstractHttp2ConnectionHandler.java b/core/src/main/java/com/linecorp/armeria/internal/common/AbstractHttp2ConnectionHandler.java index 50fca47015f..e5488ff4254 100644 --- a/core/src/main/java/com/linecorp/armeria/internal/common/AbstractHttp2ConnectionHandler.java +++ b/core/src/main/java/com/linecorp/armeria/internal/common/AbstractHttp2ConnectionHandler.java @@ -45,6 +45,7 @@ import io.netty.handler.codec.http2.Http2ConnectionEncoder; import io.netty.handler.codec.http2.Http2ConnectionHandler; import io.netty.handler.codec.http2.Http2Exception; +import io.netty.handler.codec.http2.Http2Exception.StreamException; import io.netty.handler.codec.http2.Http2Settings; import io.netty.handler.codec.http2.Http2Stream.State; import io.netty.handler.codec.http2.Http2StreamVisitor; @@ -111,13 +112,24 @@ protected final void onConnectionError(ChannelHandlerContext ctx, boolean outbou handlingConnectionError = true; if (Exceptions.isExpected(cause) || isGoAwaySentException(cause, connection())) { - // Ignore silently. + if (logger.isDebugEnabled()) { + logger.debug("{} HTTP/2 connection error:", ctx.channel(), cause); + } } else { logger.warn("{} HTTP/2 connection error:", ctx.channel(), cause); } super.onConnectionError(ctx, outbound, cause, filterHttp2Exception(cause, http2Ex)); } + @Override + protected void onStreamError(ChannelHandlerContext ctx, boolean outbound, Throwable cause, + StreamException http2Ex) { + if (logger.isDebugEnabled()) { + logger.debug("{} HTTP/2 stream error:", ctx.channel(), cause); + } + super.onStreamError(ctx, outbound, cause, http2Ex); + } + private static Http2Exception filterHttp2Exception(Throwable cause, @Nullable Http2Exception http2Ex) { if (http2Ex != null) { return http2Ex; From fb03f1927e82138c8d674f42ea150d0988ecf002 Mon Sep 17 00:00:00 2001 From: jrhee17 Date: Thu, 3 Nov 2022 18:42:59 +0900 Subject: [PATCH 2/3] address comments by @minwoox --- .../internal/common/AbstractHttp2ConnectionHandler.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/linecorp/armeria/internal/common/AbstractHttp2ConnectionHandler.java b/core/src/main/java/com/linecorp/armeria/internal/common/AbstractHttp2ConnectionHandler.java index e5488ff4254..e60a51ca0b6 100644 --- a/core/src/main/java/com/linecorp/armeria/internal/common/AbstractHttp2ConnectionHandler.java +++ b/core/src/main/java/com/linecorp/armeria/internal/common/AbstractHttp2ConnectionHandler.java @@ -112,9 +112,7 @@ protected final void onConnectionError(ChannelHandlerContext ctx, boolean outbou handlingConnectionError = true; if (Exceptions.isExpected(cause) || isGoAwaySentException(cause, connection())) { - if (logger.isDebugEnabled()) { - logger.debug("{} HTTP/2 connection error:", ctx.channel(), cause); - } + logger.debug("{} HTTP/2 connection error:", ctx.channel(), cause); } else { logger.warn("{} HTTP/2 connection error:", ctx.channel(), cause); } @@ -124,9 +122,7 @@ protected final void onConnectionError(ChannelHandlerContext ctx, boolean outbou @Override protected void onStreamError(ChannelHandlerContext ctx, boolean outbound, Throwable cause, StreamException http2Ex) { - if (logger.isDebugEnabled()) { - logger.debug("{} HTTP/2 stream error:", ctx.channel(), cause); - } + logger.debug("{} HTTP/2 stream error:", ctx.channel(), cause); super.onStreamError(ctx, outbound, cause, http2Ex); } From 7d1fb8ee9e9949ed5a6893bf2a8047e4988fb4a5 Mon Sep 17 00:00:00 2001 From: jrhee17 Date: Thu, 3 Nov 2022 21:03:22 +0900 Subject: [PATCH 3/3] add trace logs for expected exceptions --- .../armeria/internal/common/AbstractHttp2ConnectionHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/linecorp/armeria/internal/common/AbstractHttp2ConnectionHandler.java b/core/src/main/java/com/linecorp/armeria/internal/common/AbstractHttp2ConnectionHandler.java index e60a51ca0b6..f4cd0c32690 100644 --- a/core/src/main/java/com/linecorp/armeria/internal/common/AbstractHttp2ConnectionHandler.java +++ b/core/src/main/java/com/linecorp/armeria/internal/common/AbstractHttp2ConnectionHandler.java @@ -112,7 +112,7 @@ protected final void onConnectionError(ChannelHandlerContext ctx, boolean outbou handlingConnectionError = true; if (Exceptions.isExpected(cause) || isGoAwaySentException(cause, connection())) { - logger.debug("{} HTTP/2 connection error:", ctx.channel(), cause); + logger.trace("{} HTTP/2 connection error:", ctx.channel(), cause); } else { logger.warn("{} HTTP/2 connection error:", ctx.channel(), cause); }