[Bug]: Shared OTel plugin state mixes concurrent LMI invocations
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- java
调研方向
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 内容生成。
描述
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
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aws/aws-durable-execution-sdk-java 的其他 Issue
-
documentation pkg:sdk
难度 1/5 1-3 小时 新手友好度 88/100
aws/aws-durable-execution-sdk-java#645 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
aws/aws-durable-execution-sdk-java#300 ·
维护者通常 1 天内回复
-
enhancement needs-triage
难度 5/5 一周以上 新手友好度 35/100
aws/aws-durable-execution-sdk-java#779 ·
维护者通常 1 天内回复
-
[Bug]: root handler instrumentation misses the canonical OTel execution context可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭needs-triage
难度 5/5 一周以上 新手友好度 40/100
aws/aws-durable-execution-sdk-java#770 ·
维护者通常 1 天内回复
-
[Feature]: Propagate per-operation trace context for chained invokes可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭enhancement needs-triage
难度 5/5 一周以上 新手友好度 38/100
aws/aws-durable-execution-sdk-java#764 ·
维护者通常 1 天内回复
查看 aws/aws-durable-execution-sdk-java 的全部 Issue
相似的 Issue
-
[Bug] Logo style setting missing and `classic` style not applied across multiple platforms (v3.1.0)未关闭
难度 2/5 1-3 小时 新手友好度 75/100
Stirling-Tools/Stirling-PDF#8382 · 1 个 reaction ·
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 70/100
维护者通常 4 天内回复
-
enhancement untriaged
难度 2/5 1-3 小时 新手友好度 78/100
opensearch-project/sql#5842 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
openhab/openhab-addons#21882 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
YunaiV/ruoyi-vue-pro#1273 ·
维护者通常 3 天内回复