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

[Bug]: Shared OTel plugin state mixes concurrent LMI invocations

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

I maintainer di solito rispondono entro 1 giorno

@ParidelPooya ci sta già lavorando.

Dal 17/9/2026.

  • #721 di @ParidelPooya — aperta

Valutazione

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

Direzione di ricerca

Start with ExecutionOtelPlugin.java and InvocationOtelPlugin.java, then read PluginRunner.java to understand the real SDK registration and dispatch path. The issue asks for overlapping-invocation tests covering both OTel views, lifecycle cases and reused operation IDs, plus deployed LMI coverage proving same-JVM overlap; verify those outcomes and any registration migration documentation. PR #721 is already open proposing per-invocation plugin instances.

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

Descrizione

bug needs-triage
Expected Behavior

Concurrent Lambda Managed Instances invocations must keep their OTel execution state isolated. Each operation must be attributed to its owning execution, and ending/resetting one invocation must not invalidate another invocation’s telemetry.

Actual Behavior

A single published ExecutionOtelPlugin instance stores the current execution ARN and span state in mutable fields. Interleaving onInvocationStart(A), onInvocationStart(B) and onOperationEnd(A-step) exports A-step with B’s durable.execution.arn. The same sequence using separate plugin instances correctly exports A’s ARN. Java LMI shares the handler/JVM between request threads, so environment-lifetime plugin objects can be used by overlapping invocations.

This was reproduced locally with the published plugin and an in-memory exporter. The interleaving is deterministic; it is not a fresh cloud concurrency measurement.

Steps to Reproduce

Use a scratch Maven project with software.amazon.lambda.durable:aws-durable-execution-sdk-java-plugin-otel:2.2.1 and io.opentelemetry:opentelemetry-sdk-testing:1.65.0, including their transitive dependencies. Compile and run OtelLmiStateProbe below on Java 25. No Lambda credentials or service calls are involved.

The shared-object case reports A’s operation under .../B; the separate-instance control reports .../A. Assertions describe the pre-fix behavior.

Reproduction code
import java.time.Instant;
import java.util.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.sdk.trace.SdkTracerProvider;
import io.opentelemetry.sdk.trace.samplers.Sampler;
import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
import io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter;
import software.amazon.lambda.durable.otel.*;
import software.amazon.lambda.durable.plugin.*;

public class OtelLmiStateProbe {
    static final Instant START=Instant.parse("2026-10-02T00:00:00Z");
    static final String BASE="arn:aws:lambda:us-west-2:123456789012:function:probe:1/durable-execution/probe/";
    static ExecutionOtelPlugin plugin(InMemorySpanExporter exporter) {
        return new ExecutionOtelPlugin(
            SdkTracerProvider.builder().setSampler(Sampler.alwaysOn()).addSpanProcessor(SimpleSpanProcessor.create(exporter)),
            OtelPluginConfig.builder().enableMdc(false).contextExtractor(() -> null).build());
    }
    public static void main(String[] args) throws Exception {
        var results=new ArrayList<Map<String,Object>>();
        for (boolean shared:new boolean[]{true,false}) {
            var exporter=InMemorySpanExporter.create();
            var a=plugin(exporter);
            var b=shared?a:plugin(exporter);
            a.onInvocationStart(new InvocationInfo("request-A",BASE+"A",true,START));
            b.onInvocationStart(new InvocationInfo("request-B",BASE+"B",true,START));
            a.onOperationEnd(new OperationEndInfo("A-step","A-step","STEP","Step",null,START,START.plusSeconds(1),"SUCCEEDED",null,false,null));
            var spans=exporter.getFinishedSpanItems().stream().filter(s -> s.getName().equals("A-step")).toList();
            if(spans.size()!=1)throw new AssertionError("Expected one A-step span");
            var assignedArn=spans.getFirst().getAttributes().get(AttributeKey.stringKey("durable.execution.arn"));
            if(!(BASE+(shared?"B":"A")).equals(assignedArn))throw new AssertionError("Unexpected assignment: "+assignedArn);
            results.add(Map.of("sharedPluginInstance",shared,"operation","A-step","expectedExecution",BASE+"A","actualExecution",assignedArn));
        }
        System.out.println(new ObjectMapper().writeValueAsString(Map.of("sdkAndPluginVersion","2.2.1","results",results,"checksPassed",true)));
    }
}
SDK Version

Core SDK / OTel plugin 2.2.1. Main rechecked at 78574e3051aac9b5ca00a0c1fd2b91eab72a9e15.

Java Version

Corretto 25.0.4.1

Is this a regression?

Unknown; no last-known-good version has been established.

Additional Context

The Java LMI runtime uses request threads sharing one handler and static state. Relevant code: ExecutionOtelPlugin, InvocationOtelPlugin, and plugin dispatch.

PR #721 proposes per-invocation plugin instances. This issue tracks the OTel defect and its release/validation outcome. The core executor/deadline issues in #726 and the cloud-test request in #727 remain separate work.

Acceptance criteria
  • Verify both OTel views with overlapping invocations and reused operation IDs through the real SDK registration/dispatch path.
  • Ensure invocation completion, suspension, retries, errors and late hooks cannot alter another invocation’s spans or context.
  • Preserve shared provider/exporter ownership and add deployed LMI coverage with proven same-JVM overlap.
  • Document the factory migration and compatible SDK/plugin versions if the fix changes registration.

Related cross-SDK tracking: https://github.com/aws/aws-durable-execution-sdk-js/issues/950

Lingua principale
Java
Stelle
28
Fork
13
Merge medio
2g 3h
PR unite (30g)
44

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.