From 60d3e7c5362a739f6795a2a87fc86a62059de501 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Thu, 10 Dec 2020 14:54:33 -0800 Subject: [PATCH] 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. --- .../grpc/internal/Http2ClientStreamTransportState.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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); }