`TaskOrchestrationContext.waitForExternalEvent` Timeout "Removed" After Attempting to Schedule Duplicate Orchestration
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- java
研究方向
從 issue 中的 Java 重現開始,重點關注 TaskOrchestrationContext.waitForExternalEvent 和重複的 scheduleNewOrchestrationInstance 呼叫。執行 orchestrator 觸發情境,並驗證即使再次嘗試排程相同的執行個體 ID,第二個外部事件也會在一秒後逾時。
由索引模型根據 Issue 內容生成。
描述
Summary
An orchestration which specifies a timeout for waiting on an external event will seemingly have that timeout "removed"/ignored after another attempt is made to schedule an orchestration instance with the same ID.
Steps to Reproduce
- Copy the example below.
- Execute the
orchestrator-triggerfunction via HTTP.
@FunctionName("orchestrator-trigger")
public HttpResponseMessage triggerOrchestrator(
@HttpTrigger(
name = "request",
methods = { HttpMethod.GET },
authLevel = AuthorizationLevel.FUNCTION,
route = "orchestrator/trigger"
)
HttpRequestMessage<String> request,
@DurableClientInput(name = "durableContext")
DurableClientContext durableContext,
ExecutionContext context
) throws InterruptedException {
DurableTaskClient client = durableContext.getClient();
String instanceId = "the-only-instance";
client.scheduleNewOrchestrationInstance("orchestrator", null, instanceId);
client.raiseEvent(instanceId, "first", 1);
// Attempting to schedule another orchestration instance with the same instance ID results
// in the event timeout within the existing orchestrator instance from triggering.
try {
client.scheduleNewOrchestrationInstance("orchestrator", null, instanceId);
} catch (RuntimeException ignored) { }
Thread.sleep(10_000);
client.raiseEvent(instanceId, "second", 2);
return request.createResponseBuilder(HttpStatus.OK).build();
}
@FunctionName("orchestrator")
public void orchestrator(
@DurableOrchestrationTrigger(name = "orchestration")
TaskOrchestrationContext orchestration,
ExecutionContext context
) {
Task<Integer> firstTask =
orchestration.waitForExternalEvent("first", Duration.ofSeconds(1), Integer.class);
Task<Integer> secondTask =
orchestration.waitForExternalEvent("second", Duration.ofSeconds(1), Integer.class);
List<Integer> results = orchestration.allOf(firstTask, secondTask).await();
int first = results.get(0);
int second = results.get(1);
System.out.printf("Triggered! First: %s, Second: %s\n", first, second);
}
Expected Result
The orchestration throws an exception due to the second event not arriving within one second.
Actual Result
After ten seconds, the orchestration prints Triggered! First: 1, Second: 2.
Additional Context
Deleting the entire try/catch block that contains the second scheduleNewOrchestrationInstance call results in the expected outcome - the orchestration throws.
This test case is contrived - my actual use case is:
- A process operates on the combination of a ZIP file and a CSV file.
- These two files are provided to the application separately, in any order, but at roughly the same time.
- Whichever file arrives first needs to start an orchestration instance that will wait for both files.
- We need to avoid a race condition that would result in two separate orchestration instances being created, each waiting for the opposite file. So we'll create a deterministic instance ID based on other data, have the CSV/ZIP receivers always attempt to schedule an orchestration instance with that ID, and ignore the "already exists" error when it occurs.
- The CSV/ZIP receivers then simply send their own single event to the orchestration instance.
- The orchestration instance needs to have a timeout in the situation where the second file never arrives.
- 主要語言
- Java
- 星號
- 29
- 分支
- 18
- 平均合併
- 54 分鐘
- 30 天內合併 PR
- 1
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/durabletask-java 的其他 Issue
-
Needs: Triage :mag:
難度 4/5 3-5 天 新手友好度 48/100
microsoft/durabletask-java#303 ·
-
Needs: Triage :mag:
難度 4/5 3-5 天 新手友好度 45/100
microsoft/durabletask-java#290 · 2 則留言 ·
-
Needs: Triage :mag:
難度 5/5 一週以上 新手友好度 35/100
microsoft/durabletask-java#285 ·
-
Needs: Triage :mag:
難度 3/5 1-2 天 新手友好度 68/100
microsoft/durabletask-java#276 ·
-
Wrap gRPC StatusRuntimeException across all client and worker gRPC calls可能重新可做 @bachuv 於 172 天前認領,目前沒有進行中的 PR。 未關閉Enhancement
microsoft/durabletask-java#274 · 1 個 reaction · 已指派 2 人 ·
查看 microsoft/durabletask-java 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
OpenAPITools/openapi-generator#25014 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 92/100
AloisSeckar/demos-java#380 ·
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
openhab/openhab-core#5847 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
appsmithorg/appsmith#42297 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100