Always log Http2UnknownStreamError at DEBUG
level (#11643)
Motivation: Exception logged by `onHttp2UnknownStreamError` is propagated to the upper layers anyway. Receiver of the exception is responsible for correct handling. Inside netty, it's enough to log at `DEBUG` level. Modifications: - `Http2FrameCodec#onHttp2UnknownStreamError` always logs at `DEBUG` level; Result: Less noise in logs when `Http2UnknownStreamError` is properly handled by upper layers. Co-authored-by: Norman Maurer <norman_maurer@apple.com> Co-authored-by: Chris Vest <mr.chrisvest@gmail.com>
This commit is contained in:
parent
cba3b4dd57
commit
6a2b9a76fe
@ -32,7 +32,6 @@ import io.netty.util.collection.IntObjectMap;
|
||||
import io.netty.util.concurrent.Future;
|
||||
import io.netty.util.concurrent.Promise;
|
||||
import io.netty.util.internal.UnstableApi;
|
||||
import io.netty.util.internal.logging.InternalLogLevel;
|
||||
import io.netty.util.internal.logging.InternalLogger;
|
||||
import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
@ -40,6 +39,7 @@ import static io.netty.buffer.ByteBufUtil.writeAscii;
|
||||
import static io.netty.handler.codec.http2.Http2CodecUtil.HTTP_UPGRADE_STREAM_ID;
|
||||
import static io.netty.handler.codec.http2.Http2CodecUtil.isStreamIdValid;
|
||||
import static io.netty.handler.codec.http2.Http2Error.NO_ERROR;
|
||||
import static io.netty.util.internal.logging.InternalLogLevel.DEBUG;
|
||||
|
||||
/**
|
||||
* <p><em>This API is very immature.</em> The Http2Connection-based API is currently preferred over this API.
|
||||
@ -557,14 +557,14 @@ public class Http2FrameCodec extends Http2ConnectionHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void onHttp2UnknownStreamError(@SuppressWarnings("unused") ChannelHandlerContext ctx, Throwable cause,
|
||||
Http2Exception.StreamException streamException) {
|
||||
// It is normal to hit a race condition where we still receive frames for a stream that this
|
||||
// peer has deemed closed, such as if this peer sends a RST(CANCEL) to discard the request.
|
||||
// Since this is likely to be normal we log at DEBUG level.
|
||||
InternalLogLevel level =
|
||||
streamException.error() == Http2Error.STREAM_CLOSED ? InternalLogLevel.DEBUG : InternalLogLevel.WARN;
|
||||
LOG.log(level, "Stream exception thrown for unknown stream {}.", streamException.streamId(), cause);
|
||||
private static void onHttp2UnknownStreamError(@SuppressWarnings("unused") ChannelHandlerContext ctx,
|
||||
Throwable cause, Http2Exception.StreamException streamException) {
|
||||
// We log here for debugging purposes. This exception will be propagated to the upper layers through other ways:
|
||||
// - fireExceptionCaught
|
||||
// - fireUserEventTriggered(Http2ResetFrame), see Http2MultiplexHandler#channelRead(...)
|
||||
// - by failing write promise
|
||||
// Receiver of the error is responsible for correct handling of this exception.
|
||||
LOG.log(DEBUG, "Stream exception thrown for unknown stream {}.", streamException.streamId(), cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user