grpc / grpc/grpc-java

Unexpected error when server expands a compressed message to learn it is too large

オープン
#11,246 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Java
スター
12.1k
フォーク
4k
平均マージ
2日 17時間
マージ済み PR(30日)
37

説明

When the client uses “gzip” compression to compress requests, if it sends a message where the compressed size is acceptable (less than or equal to the server’s configured max) but the uncompressed size is too large, the client receives an unhelpful UNKNOWN error with a message of “Application error processing RPC”.

Interestingly, an error is logged with an exception that indicates the expected/correct error code. It’s not a warning but an error with a message that implies the exception was never caught:

```
SEVERE: Exception while executing runnable io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1MessagesAvailable@2339b6a8
io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: Decompressed gRPC message exceeds maximum size 204800
at io.grpc.Status.asRuntimeException(Status.java:525)
at io.grpc.internal.MessageDeframer$SizeEnforcingInputStream.verifySize(MessageDeframer.java:523)
at io.grpc.internal.MessageDeframer$SizeEnforcingInputStream.read(MessageDeframer.java:478)
at com.google.protobuf.CodedInputStream$StreamDecoder.readRawBytesSlowPathRemainingChunks(CodedInputStream.java:2967)
at com.google.protobuf.CodedInputStream$StreamDecoder.readBytesSlowPath(CodedInputStream.java:3006)
at com.google.protobuf.CodedInputStream$StreamDecoder.readBytes(CodedInputStream.java:2397)
at testing.TestRequest$Builder.mergeFrom(TestRequest.java:501)
at testing.TestRequest$1.parsePartialFrom(TestRequest.java:849)
at testing.TestRequest$1.parsePartialFrom(TestRequest.java:841)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:63)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:25)
at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parseFrom(ProtoLiteUtils.java:245)
at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parse(ProtoLiteUtils.java:237)
at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parse(ProtoLiteUtils.java:134)
at io.grpc.MethodDescriptor.parseRequest(MethodDescriptor.java:307)
at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.messagesAvailableInternal(ServerCallImpl.java:334)
at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.messagesAvailable(ServerCallImpl.java:319)
at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1MessagesAvailable.runInContext(ServerImpl.java:834)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

io.grpc.internal.MessageDeframer と ServerCallImpl.ServerStreamListenerImpl から始め、スタックトレースを使って、解凍サイズの例外がどのように ServerImpl に到達するかを追跡します。解凍後のサイズが 204800 を超える gzip 圧縮リクエストを再現し、その後、クライアントが UNKNOWN ではなく RESOURCE_EXHAUSTED を受信し、その例外が未捕捉の SEVERE エラーとしてログに記録されなくなったことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
grpc, java
領域
api, backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。