Http2MultiplexCodec should propagate unhandled Http2Frames down the pipeline
Motivation: Http2MultiplexCodec swallows Http2PingFrames without releasing the payload, resulting in a memory leak. Modification: Send unhandled frames down the pipeline for consumption/disposal by another InboundChannelHandler. Result: Fixes #7607.
This commit is contained in:
parent
f0c76cacc3
commit
8a095d0244
@ -227,6 +227,9 @@ public class Http2MultiplexCodec extends Http2FrameCodec {
|
|||||||
if (settings.initialWindowSize() != null) {
|
if (settings.initialWindowSize() != null) {
|
||||||
initialOutboundStreamWindow = settings.initialWindowSize();
|
initialOutboundStreamWindow = settings.initialWindowSize();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Send any other frames down the pipeline
|
||||||
|
ctx.fireChannelRead(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,6 +170,17 @@ public class Http2MultiplexCodecTest {
|
|||||||
verifyFramesMultiplexedToCorrectChannel(inboundStream, inboundHandler, 2);
|
verifyFramesMultiplexedToCorrectChannel(inboundStream, inboundHandler, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void unhandledHttp2FramesShouldBePropagated() {
|
||||||
|
ByteBuf content = UnpooledByteBufAllocator.DEFAULT.buffer(8).writeLong(0);
|
||||||
|
Http2PingFrame decodedFrame = new DefaultHttp2PingFrame(content);
|
||||||
|
|
||||||
|
codec.onHttp2Frame(decodedFrame);
|
||||||
|
Http2PingFrame receivedPing = parentChannel.readInbound();
|
||||||
|
assertSame(receivedPing, decodedFrame);
|
||||||
|
assertTrue(receivedPing.release());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void channelReadShouldRespectAutoRead() {
|
public void channelReadShouldRespectAutoRead() {
|
||||||
LastInboundHandler inboundHandler = streamActiveAndWriteHeaders(inboundStream);
|
LastInboundHandler inboundHandler = streamActiveAndWriteHeaders(inboundStream);
|
||||||
|
Loading…
Reference in New Issue
Block a user