[Bug]: Execution OTel view retains the ended attempt spanId in MDC
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 54/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- java
- 领域
- observability, testing
调研方向
Read ExecutionOtelPlugin.java around the Execution-view start and End hooks, then compare the MDC cleanup in InvocationOtelPlugin.java. Start by tracing scope and MDC handling across normal completion, failure, early returns, nested context, and suspension/resume. Add focused lifecycle assertions immediately after the End hook returns with MDC enabled, and verify that trace context is preserved and MDC-disabled behavior remains unaffected.
由索引模型根据 Issue 内容生成。
描述
Expected Behavior
After ExecutionOtelPlugin.onUserFunctionEnd closes a completed attempt's OTel scope, MDC should no longer identify that ended attempt as the current span. Cleanup should happen before the hook returns, while preserving valid surrounding trace context.
Actual Behavior
Public main at 1c4922293d01bbd3a18082f0d9ea819a361a2227 injects the attempt span into MDC at user-function start, but the Execution-view End hook closes the OTel scope without removing its spanId from MDC. The Invocation-view End hook explicitly removes that key.
- Execution-view start hook: makes the attempt span current and injects MDC.
- Execution-view End hook: closes
attemptScopes, handles early returns, and ends the attempt span without removing the MDC span ID. - Invocation-view End hook: calls
MDC.remove(MdcSpanEnricher.MDC_SPAN_ID)when MDC enrichment is enabled, before early returns. - Execution-view invocation cleanup: clears MDC at invocation end.
This creates a potential post-attempt correlation window in which a log can retain the ended attempt's span ID until later cleanup. The scope of this report is the missing cleanup at the End-hook boundary, not a claim of permanent or cross-invocation leakage.
Steps to Reproduce
This report is based on public source inspection. The following runtime validation recipe has not been executed for this report:
- Configure the Execution OTel view with MDC enrichment enabled, a recording provider, and an MDC-capable SLF4J binding.
- In a focused lifecycle test, begin an invocation, an operation, and its user-function attempt on the owning thread. Record the attempt's span ID from MDC.
- Complete the user function and inspect
MDC.get("spanId")immediately afteronUserFunctionEndreturns, before any enclosing logger scope or invocation cleanup runs. Compare it withSpan.current(). - Repeat with the Invocation view configured separately as a control.
Expected: MDC no longer reports the ended attempt's span ID. The source shows that only the Invocation-view End hook explicitly removes it.
SDK Version
Java SDK otel-plugin, public main at 1c4922293d01bbd3a18082f0d9ea819a361a2227.
Java Version
Not applicable to source inspection; no runtime reproduction was run for this report.
Is this a regression?
Unknown; no last working version has been established.
Acceptance Criteria
- Remove or correctly restore the completed attempt's MDC span context before the Execution-view End hook returns; retain appropriate trace-level correlation.
- Add a focused assertion immediately after the hook, before enclosing logger-scope cleanup can mask the defect. Cover normal completion, failure, and relevant early-return paths with MDC enabled.
- Verify nested context restoration and suspension/resume, with the Invocation view as a control and MDC-disabled configurations unaffected.
- 主要语言
- Java
- 星标
- 28
- 派生
- 16
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 56
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aws/aws-durable-execution-sdk-java 的其他 Issue
-
documentation pkg:sdk
难度 1/5 1-3 小时 新手友好度 88/100
aws/aws-durable-execution-sdk-java#645 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
aws/aws-durable-execution-sdk-java#300 ·
维护者通常 1 天内回复
-
[Epic]: Durable Functions on LMI可能已有人在做 @zhongkechen 于 9 天前认领。 未关闭
aws/aws-durable-execution-sdk-java#798 · 已指派 1 人 ·
维护者通常 1 天内回复
-
needs-triage
难度 5/5 一周以上 新手友好度 8/100
aws/aws-durable-execution-sdk-java#787 ·
维护者通常 1 天内回复
-
enhancement needs-triage
难度 5/5 一周以上 新手友好度 35/100
aws/aws-durable-execution-sdk-java#779 ·
维护者通常 1 天内回复
查看 aws/aws-durable-execution-sdk-java 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 67/100
-
难度 2/5 1-3 小时 新手友好度 76/100
linagora/twake-calendar-side-service#1218 · 1 条评论 ·
维护者通常 1 天内回复
-
[Bug] [Go] Ack returns nil when the server answers with a non-OK status可能已有人在做 @leizhiyuan 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
apache/rocketmq-clients#1465 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
pdfium-drift
难度 1/5 1 小时以内 新手友好度 88/100
Stirling-Tools/JPDFium#188 ·
维护者通常 1 天内回复