grpc / grpc/grpc-java

Make ServerImpl's internalClose thread-safe

オープン
#3,746 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
Java
スター
12.1k
フォーク
4k
平均マージ
2日 17時間
マージ済み PR(30日)
37

説明

So we have this in ServerImpl.JumpToApplicationThreadServerStreamListener:

/**
 * Like {@link ServerCall#close(Status, Metadata)}, but thread-safe for internal use.
 */
private void internalClose() {
  // TODO(ejona86): this is not thread-safe :)
  stream.close(Status.UNKNOWN, new Metadata());
}

We should fix that. There's two ways to fix this:

  1. Allow truncated messages in our stream and deliver trailers. This would be nicest and would be helpful in other cases (like if too many requests are sent in a server call), as we can deliver a message to the client
  2. Treat this as a cancel and send RST_STREAM. This would be similar to client-side cancellation, but we'd still need to verify it'd be safe on server-side.

In either case it'd probably be good if we made this trigger onCancel instead of onCompleted. That'd probably happen naturally for (2), but (1) would need special plumbing, but it's probably not too onerous.

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

ServerImpl.JumpToApplicationThreadServerStreamListener から開始し、stream.close まで internalClose を追跡します。truncated-message/trailers と cancellation の代替案を、onCancel と onCompleted の動作の違いを含めて比較します。internalClose がスレッドセーフで、結果として生じる callback のセマンティクスが検証されれば完了です。

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

評価

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

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

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