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

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

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

维护者通常 1 天内回复

@ParidelPooya 已经在做这个了。

开始于 2026年9月17日。

  • #721 来自 @ParidelPooya —— 未关闭

评估

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

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Java
星标
28
派生
13
平均合并
2 天 3 小时
30 天内合并 PR
44

环境准备

从这里开始

  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 摘要。