[Bug]: get() on a SKIPPED parallel branch never returns, and the execution fails
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- java
調査の方向性
Start with ParallelOperation.handleCompletion and ParallelOperation.branch(), then inspect ChildContextOperation.handleChildContextSuccess and the sdk-integration-tests using LocalDurableTestRunner. Compare both skipped-branch cases across the first invocation and replay, and update docs/core/parallel.md as needed. Done means get() consistently returns or throws a named branch exception without producing PENDING with no pending operation.
索引モデルが issue の本文から書いたものです。
説明
Expected Behavior
get() on a branch future returns the branch result or throws an exception. It behaves the same way in the first invocation and on every replay.
The parallel result can record a branch as SKIPPED. For such a branch, get() should throw an exception that names the branch. docs/core/parallel.md should document it. For comparison, docs/core/map.md defines a skipped map item: status SKIPPED, a null result, and a null error.
Actual Behavior
get() on a SKIPPED branch does not return, and it does not throw a branch exception. It waits until the SDK suspends the invocation. The invocation then returns PENDING with no pending operation. In the cloud, the service rejects that output with InvalidParameterValueException: Cannot return PENDING status with no pending operations., the same error as in #736. Every replay reaches the same state, so the execution fails.
This happens in two cases.
Case 1: the branch never started.
- A completion config such as
firstSuccessful()completes the parallel before every branch has started. ParallelOperation.handleCompletionrecords each branch whose future is not complete asSKIPPED.- The SDK does not start that branch later. Nothing completes its future until the SDK suspends the invocation.
get()on the branch releases the calling thread and waits. If no other thread is active, the SDK suspends the invocation. The suspension ends the wait with the SDK's internalSuspendExecutionException.- On replay,
ParallelOperation.branch()readsSKIPPEDfrom the checkpointed result and does not queue the branch. So every replay repeats steps 3 and 4.
Case 1 needs no race, and it fails in the first invocation. The repro uses firstSuccessful(). handleCompletion applies the same rule for every completion config that can complete early: minSuccessful(n), allSuccessful(), toleratedFailureCount(n), and shouldComplete(...).
Case 2: the branch was still running when the parallel completed.
- With unlimited concurrency, branch-b can still be running when branch-a completes the parallel. The checkpointed result records branch-b as
SKIPPED. - branch-b finishes later in the same invocation.
ChildContextOperation.handleChildContextSuccessdoes not checkpoint the result, because the parallel is already complete.get()returns the result from memory. - A later operation, such as a wait, suspends the invocation. The next invocation replays the handler.
- On replay,
ParallelOperation.branch()readsSKIPPEDand does not run branch-b. Theget()call that returned a value in the first invocation now waits until the SDK suspends, as in case 1.
In case 2, the same handler code returns a value in the first invocation and fails on replay.
Steps to Reproduce
Both cases run in sdk-integration-tests with LocalDurableTestRunner.
Case 1 is the basic pattern from docs/core/parallel.md with firstSuccessful():
var runner = LocalDurableTestRunner.create(String.class, (input, context) -> {
var config = ParallelConfig.builder()
.maxConcurrency(1)
.completionConfig(CompletionConfig.firstSuccessful())
.build();
var parallel = context.parallel("first-successful", config);
var a = parallel.branch("branch-a", String.class, ctx -> "A");
var b = parallel.branch("branch-b", String.class, ctx -> "B");
parallel.get(); // MIN_SUCCESSFUL_REACHED, statuses [SUCCEEDED, SKIPPED]
a.get(); // "A"
return b.get(); // never returns a value or throws a branch exception
});
var result = runner.runUntilComplete("input");
assertEquals(ExecutionStatus.PENDING, result.getStatus());
The result has status PENDING and no error. The execution state holds first-successful (Parallel, SUCCEEDED) and branch-a (ParallelBranch, SUCCEEDED). No operation is pending. The invocation logs Invalid suspension. No operation is pending. Each further runner.run("input") gives the same result. The outcome is the same with NestingType.FLAT, and with DurableFuture.allOf(...) over both branches in place of b.get().
Case 2 uses unlimited concurrency. A wait after the parallel forces a replay:
var runner = LocalDurableTestRunner.create(String.class, (input, context) -> {
var config = ParallelConfig.builder()
.completionConfig(CompletionConfig.firstSuccessful())
.build();
var parallel = context.parallel("first-successful", config);
var a = parallel.branch("branch-a", String.class, ctx -> sleepThen(200, "A"));
var b = parallel.branch("branch-b", String.class, ctx -> sleepThen(1000, "B"));
parallel.get(); // statuses [SUCCEEDED, SKIPPED]: branch-b is still running
var value = a.get() + b.get(); // "AB" in the first invocation
context.wait("pause", Duration.ofSeconds(1)); // any later suspension causes a replay
return value;
});
runner.run("input"); // invocation 1
runner.advanceTime(); // completes "pause"
runner.run("input"); // invocation 2, a replay
sleepThen(ms, value) calls Thread.sleep(ms) and returns value.
| Invocation | a.get() + b.get() |
Output | Pending operations |
|---|---|---|---|
| 1 | returns "AB" |
PENDING |
1 (pause) |
| 2 | does not return | PENDING, no error |
0 |
| 3 and 4 | does not return | PENDING, no error |
0 |
Invocations 2 to 4 each log Invalid suspension. No operation is pending. The outcome is the same with NestingType.FLAT.
SDK Version
2.2.1. Reproduced on main at ef88276 (2.2.2-SNAPSHOT). No file under sdk/src/main changed between v2.2.1 and ef88276.
Java Version
21
Is this a regression?
Unknown
Additional Context
- #736 listed this as a follow-up: "Make
get()on a persisted skipped branch fail explicitly instead of waiting forever." #737 fixed the race in #736 and did not change this behavior. #736 described the replay of a persisted result. Case 1 also fails in the first invocation. - A fix for case 2 has to make the first invocation and the replay agree. One option:
get()throws for every branch that the checkpointed result records asSKIPPED, including a branch that finished later in the first invocation. Another option: the SDK checkpoints a late branch result so that replay returns it. - The
ParallelResulttable indocs/core/parallel.mddoes not listskipped()orstatuses(). - The end state,
PENDINGwith no pending operation, is the state that #370 and #736 also reached. How the SDK reports that state is a separate issue.
- 主要言語
- Java
- スター
- 28
- フォーク
- 13
- 平均マージ
- 2日 3時間
- マージ済み PR(30日)
- 44
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 1週間以上 初心者へのやさしさ 35/100
aws/aws-durable-execution-sdk-java#779 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: root handler instrumentation misses the canonical OTel execution context対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンneeds-triage
難易度 5/5 1週間以上 初心者へのやさしさ 40/100
aws/aws-durable-execution-sdk-java#770 ·
メンテナーはふだん 1 日以内に返信
-
[Feature]: Propagate per-operation trace context for chained invokes対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンenhancement needs-triage
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
aws/aws-durable-execution-sdk-java#764 ·
メンテナーはふだん 1 日以内に返信
aws/aws-durable-execution-sdk-java の issue をすべて見る
似ている issue
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
helidon-io/helidon#12721 ·
メンテナーはふだん 1 日以内に返信
-
status: team-only type: dependency-upgrade
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
spring-projects/spring-boot#51966 ·
メンテナーはふだん 1 日以内に返信
-
Missing repro Platform: Android
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
software-mansion/react-native-reanimated#10816 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
area/docs backport/26.6 backport/26.8 kind/bug status/triage
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
[destination-snowflake] Custom domains rejected unlike source connections対応中かも @kuza55 が今日担当しました。 オープンautoteam community connectors/destination/snowflake team/use
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信