commit | e7a43e4e388bdfcdfd5882a7ee97a754a854317a | [log] [tgz] |
---|---|---|
author | ejona <ejona@google.com> | Fri Jul 11 14:45:21 2014 -0700 |
committer | Eric Anderson <ejona@google.com> | Thu Jan 08 14:42:28 2015 -0800 |
tree | 0b791521010a2f825571dc7e4224d3c4a7db0f81 | |
parent | cc7cdb1ab40a69901d0542579a26f732fc812ebd [diff] |
Workaround error caused by zero-length DATA frames. The real solution is to not assume gRPC frame/DATA frame alignment, but that is a much larger piece of work. The bug was exposed via talking HTTP/2 to GFE which used a separate DATA frame for closing the stream. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=70982223
diff --git a/core/src/main/java/com/google/net/stubby/http2/netty/ByteBufDeframer.java b/core/src/main/java/com/google/net/stubby/http2/netty/ByteBufDeframer.java index e7f06c8..e72e873 100644 --- a/core/src/main/java/com/google/net/stubby/http2/netty/ByteBufDeframer.java +++ b/core/src/main/java/com/google/net/stubby/http2/netty/ByteBufDeframer.java
@@ -52,6 +52,10 @@ @Override protected ByteBuf decompress(ByteBuf frame) throws IOException { + if (frame.readableBytes() == 0) { + frame.retain(); + return frame; + } frame = frame.order(ByteOrder.BIG_ENDIAN); int compressionType = frame.readUnsignedByte(); int frameLength = frame.readUnsignedMedium();
diff --git a/core/src/main/java/com/google/net/stubby/newtransport/netty/ByteBufDeframer.java b/core/src/main/java/com/google/net/stubby/newtransport/netty/ByteBufDeframer.java index 84944ab..0e8b185 100644 --- a/core/src/main/java/com/google/net/stubby/newtransport/netty/ByteBufDeframer.java +++ b/core/src/main/java/com/google/net/stubby/newtransport/netty/ByteBufDeframer.java
@@ -54,6 +54,10 @@ @Override protected ByteBuf decompress(ByteBuf frame) throws IOException { + if (frame.readableBytes() == 0) { + frame.retain(); + return frame; + } frame = frame.order(ByteOrder.BIG_ENDIAN); int compressionType = frame.readUnsignedByte(); int frameLength = frame.readUnsignedMedium();