Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: Execution OTel view retains the ended attempt spanId in MDC

未关闭
#815 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
54/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java

调研方向

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 内容生成。

描述

bug needs-triage
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.

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:

  1. Configure the Execution OTel view with MDC enrichment enabled, a recording provider, and an MDC-capable SLF4J binding.
  2. 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.
  3. Complete the user function and inspect MDC.get("spanId") immediately after onUserFunctionEnd returns, before any enclosing logger scope or invocation cleanup runs. Compare it with Span.current().
  4. 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aws/aws-durable-execution-sdk-java 的其他 Issue

查看 aws/aws-durable-execution-sdk-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。