diff --git a/core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java b/core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java index da9f7bc5d1d..c2bcb350a9f 100644 --- a/core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java +++ b/core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java @@ -144,11 +144,17 @@ protected void transportDataReceived(ReadableBuffer frame, boolean endOfStream) new Metadata()); return; } + int frameSize = frame.readableBytes(); inboundDataReceived(frame); if (endOfStream) { // This is a protocol violation as we expect to receive trailers. - transportError = - Status.INTERNAL.withDescription("Received unexpected EOS on DATA frame from server."); + if (frameSize > 0) { + transportError = Status.INTERNAL + .withDescription("Received unexpected EOS on non-empty DATA frame from server"); + } else { + transportError = Status.INTERNAL + .withDescription("Received unexpected EOS on empty DATA frame from server"); + } transportErrorMetadata = new Metadata(); transportReportStatus(transportError, false, transportErrorMetadata); }