Skip to content

Commit 60d3e7c

Browse files
authored
core: On unexpected EOS, mention whether the frame was empty
Empty DATA frames with EOS tell a stronger tale as to where the server may have its bug.
1 parent 4be68f3 commit 60d3e7c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,17 @@ protected void transportDataReceived(ReadableBuffer frame, boolean endOfStream)
144144
new Metadata());
145145
return;
146146
}
147+
int frameSize = frame.readableBytes();
147148
inboundDataReceived(frame);
148149
if (endOfStream) {
149150
// This is a protocol violation as we expect to receive trailers.
150-
transportError =
151-
Status.INTERNAL.withDescription("Received unexpected EOS on DATA frame from server.");
151+
if (frameSize > 0) {
152+
transportError = Status.INTERNAL
153+
.withDescription("Received unexpected EOS on non-empty DATA frame from server");
154+
} else {
155+
transportError = Status.INTERNAL
156+
.withDescription("Received unexpected EOS on empty DATA frame from server");
157+
}
152158
transportErrorMetadata = new Metadata();
153159
transportReportStatus(transportError, false, transportErrorMetadata);
154160
}

0 commit comments

Comments
 (0)