Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#815 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug pkg:otel
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.
Lingua principale
Java
Stelle
28
Fork
16
Merge medio
2g 17h
PR unite (30g)
56

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws/aws-durable-execution-sdk-java

Tutte le issue di aws/aws-durable-execution-sdk-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.