Work inside the handler invocations and Context.run() calls is not interrupted when invocations are aborted
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
调研方向
首先比较 Kotlin HandlerRunner 实现与 Java HandlerRunner 对 onClosedInvocationStreamHook 的处理。跟踪 executor 进入 ContextImpl 的路径以及 Context.run() 调用,然后验证 invocation stream 因 abort 关闭后,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
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 条评论 ·
-
Reflection based experience可能重新可做 @slinkydeveloper 于 267 天前认领,目前没有进行中的 PR。 未关闭
restatedev/sdk-java#570 · 已指派 1 人 ·
-
dependencies
难度 3/5 1-2 天 新手友好度 48/100
restatedev/sdk-java#569 · 2 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 45/100
restatedev/sdk-java#555 · 1 条评论 ·
查看 restatedev/sdk-java 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
redhat-developer/intellij-quarkus#1626 ·
-
Type/Bug
难度 2/5 1-3 小时 新手友好度 68/100
wso2/product-integrator-mi#5061 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
quarkiverse/quarkus-roq#1277 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
apache/logging-site#48 ·
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
apache/maven-surefire#3496 · 3 条评论 ·
维护者通常 1 天内回复