Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#761 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@ParidelPooya ya está trabajando en esto.

Desde el 17/9/2026.

  • #721 de @ParidelPooya — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
java

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Java
Estrellas
28
Forks
13
Merge medio
2 d 8 h
PR fusionados (30 d)
40

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de aws/aws-durable-execution-sdk-java

Todos los issues de aws/aws-durable-execution-sdk-java

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.