Work inside the handler invocations and Context.run() calls is not interrupted when invocations are aborted
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
調査の方向性
まず、Kotlin HandlerRunner の実装と、Java HandlerRunner における onClosedInvocationStreamHook の処理を比較します。executor から ContextImpl へ至る経路と Context.run() の呼び出しを追跡し、その後、abort によって invocation stream が閉じられた後に、handler で実行中の処理が中断されることを確認します。この issue では具体的なファイルやテストは指定されていません。
索引モデルが issue の本文から書いたものです。
説明
Hey there. I was testing restate sdk using java and noticed that work inside the handlers was still being performed long after restate server aborted the invocations (abort timeout reached). I noticed that HandlerRunner for kotlin has an implementation that cancels work using onClosedInvocationStreamHook, but java implementation for HandlerRunner ignores onClosedInvocationStreamHook. Is this intentional?
If not, 2 solutions come to mind:
- Keep a collection of threads which are doing work by registering thread's reference inside the executor calls:
**initialize worker thread references collection here**
**set onClosedInvocationStreamHook to iterate over the worker threads and interrupt them here**
options.executor.execute(
() -> {
HANDLER_CONTEXT_THREAD_LOCAL.set(handlerContext);
try (Scope ignored =
handlerContext.request().openTelemetryContext().makeCurrent()) {
**add thread's ref to collection here**
runnable.run();
} finally {
**remove thread's ref from collection here**
HANDLER_CONTEXT_THREAD_LOCAL.remove();
}
});
- Require ExecutorService instead of Executor when setting up the handler options, so that ExecutorService.submit(...) method is used instead of Executor.execute(...) and the output Futures can be collected and used to interrupt the worker threads when onClosedInvocationStreamHook is called (Future has cancel method which can interrupt thread). However, I see that Executor is passed down to ContextImpl so this change could propagate beyond HandlerRunner's scope. Maybe an adapter between ExecutorService and Executor can be made to limit the scope (ExecutorService wrapped by Executor which is passed into ContextImpl, when Executor.execute is called, the call is delegated to ExecutorService.submit and the resulting Futures are collected inside HandlerRunner)
- 主要言語
- Java
- スター
- 60
- フォーク
- 17
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
restatedev/sdk-java のほかの issue
-
Vert.x 5 update オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
restatedev/sdk-java#629 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
restatedev/sdk-java#614 · コメント 2 件 ·
-
restatedev/sdk-java#570 · 担当者 1 名 ·
-
dependencies
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
restatedev/sdk-java#569 · コメント 2 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
restatedev/sdk-java#555 · コメント 1 件 ·
restatedev/sdk-java の issue をすべて見る
似ている issue
-
area/plugin
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
kestra-io/plugin-kestra#190 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/rocketmq-dashboard#5064 ·