diff --git a/instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/internal/server/HttpServerRequestTracingHandler.java b/instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/internal/server/HttpServerRequestTracingHandler.java index 69f90c7e8815..14618125bd8f 100644 --- a/instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/internal/server/HttpServerRequestTracingHandler.java +++ b/instrumentation/netty/netty-4.1/library/src/main/java/io/opentelemetry/instrumentation/netty/v4_1/internal/server/HttpServerRequestTracingHandler.java @@ -73,12 +73,13 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception } @Override - public void channelInactive(ChannelHandlerContext ctx) { + public void channelInactive(ChannelHandlerContext ctx) throws Exception { // connection was closed, close all remaining requests Attribute> contextAttr = ctx.channel().attr(AttributeKeys.SERVER_CONTEXT); Deque serverContexts = contextAttr.get(); if (serverContexts == null) { + super.channelInactive(ctx); return; } @@ -86,6 +87,7 @@ public void channelInactive(ChannelHandlerContext ctx) { while ((serverContext = serverContexts.pollFirst()) != null) { instrumenter.end(serverContext.context(), serverContext.request(), null, null); } + super.channelInactive(ctx); } private static Deque getOrCreate(Channel channel, AttributeKey> key) {