Skip to content

Commit

Permalink
core: On unexpected EOS, mention whether the frame was empty
Browse files Browse the repository at this point in the history
Empty DATA frames with EOS tell a stronger tale as to where the server
may have its bug.
  • Loading branch information
ejona86 authored Dec 10, 2020
1 parent 4be68f3 commit 60d3e7c
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

1 comment on commit 60d3e7c

@emkornfield
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an FYI this change broke our unfortunately brittle screen scraping logic for determining if this error is retryable googleapis/java-bigquerystorage#1128 not sure if there is a good way make this more robust.

Please sign in to comment.