Title: `TaskOrchestrationContext.waitForExternalEvent` Timeout "Removed" After Attempting to Schedule Duplicate Orchestration · Issue #203 · microsoft/durabletask-java · GitHub
Open Graph Title: `TaskOrchestrationContext.waitForExternalEvent` Timeout "Removed" After Attempting to Schedule Duplicate Orchestration · Issue #203 · microsoft/durabletask-java
X Title: `TaskOrchestrationContext.waitForExternalEvent` Timeout "Removed" After Attempting to Schedule Duplicate Orchestration · Issue #203 · microsoft/durabletask-java
Description: 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 Reprodu...
Open Graph Description: 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 ins...
X Description: 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 orchest...
Opengraph URL: https://github.com/microsoft/durabletask-java/issues/203
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`TaskOrchestrationContext.waitForExternalEvent` Timeout \"Removed\" After Attempting to Schedule Duplicate Orchestration","articleBody":"## Summary\n\nAn 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.\n\n## Steps to Reproduce\n1. Copy the example below.\n2. Execute the `orchestrator-trigger` function via HTTP.\n\n```java\n@FunctionName(\"orchestrator-trigger\")\npublic HttpResponseMessage triggerOrchestrator(\n @HttpTrigger(\n name = \"request\",\n methods = { HttpMethod.GET },\n authLevel = AuthorizationLevel.FUNCTION,\n route = \"orchestrator/trigger\"\n )\n HttpRequestMessage\u003cString> request,\n @DurableClientInput(name = \"durableContext\")\n DurableClientContext durableContext,\n ExecutionContext context\n) throws InterruptedException {\n DurableTaskClient client = durableContext.getClient();\n String instanceId = \"the-only-instance\";\n\n client.scheduleNewOrchestrationInstance(\"orchestrator\", null, instanceId);\n client.raiseEvent(instanceId, \"first\", 1);\n\n // Attempting to schedule another orchestration instance with the same instance ID results\n // in the event timeout within the existing orchestrator instance from triggering.\n try {\n client.scheduleNewOrchestrationInstance(\"orchestrator\", null, instanceId);\n } catch (RuntimeException ignored) { }\n\n Thread.sleep(10_000);\n client.raiseEvent(instanceId, \"second\", 2);\n\n return request.createResponseBuilder(HttpStatus.OK).build();\n}\n\n@FunctionName(\"orchestrator\")\npublic void orchestrator(\n @DurableOrchestrationTrigger(name = \"orchestration\")\n TaskOrchestrationContext orchestration,\n ExecutionContext context\n) {\n Task\u003cInteger> firstTask =\n orchestration.waitForExternalEvent(\"first\", Duration.ofSeconds(1), Integer.class);\n\n Task\u003cInteger> secondTask =\n orchestration.waitForExternalEvent(\"second\", Duration.ofSeconds(1), Integer.class);\n\n List\u003cInteger> results = orchestration.allOf(firstTask, secondTask).await();\n int first = results.get(0);\n int second = results.get(1);\n\n System.out.printf(\"Triggered! First: %s, Second: %s\\n\", first, second);\n}\n```\n\n## Expected Result\nThe orchestration throws an exception due to the second event not arriving within one second.\n\n## Actual Result\nAfter ten seconds, the orchestration prints `Triggered! First: 1, Second: 2`.\n\n## Additional Context\nDeleting the entire `try`/`catch` block that contains the second `scheduleNewOrchestrationInstance` call results in the expected outcome - the orchestration throws.\n\nThis test case is contrived - my actual use case is:\n- A process operates on the combination of a ZIP file and a CSV file.\n- These two files are provided to the application separately, in any order, but at roughly the same time.\n- Whichever file arrives first needs to start an orchestration instance that will wait for both files.\n- 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.\n- The CSV/ZIP receivers then simply send their own single event to the orchestration instance.\n- The orchestration instance needs to have a timeout in the situation where the second file never arrives.","author":{"url":"https://github.com/ScottHamper","@type":"Person","name":"ScottHamper"},"datePublished":"2025-02-05T20:36:03Z","url":"https://github.com/microsoft/durabletask-java/issues/203"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:192a3786-117a-c1d0-1ba6-3a797b8a4cae |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBC0:3EB23A:7C89F:A8A7D:6AFE321B |
| html-safe-nonce | ce097fce003d1a7fbe39166a821de1e1054b2d77d7712c1fe42db4fa6698d40d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkMwOjNFQjIzQTo3Qzg5RjpBOEE3RDo2QUZFMzIxQiIsInZpc2l0b3JfaWQiOiIzMDk1OTAwMTg3ODE4NjAzMDM1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 670767a4f1221f6b55f052b629867a90983e2843fb77675ec1b6fbe20516e517 |
| hovercard-subject-tag | issue:2833912397 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/durabletask-java/203/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5b75032c75e3d3004b74162f5736fc20e400bfb273ddac6775a1baa5461b269d/microsoft/durabletask-java/issues/203 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5b75032c75e3d3004b74162f5736fc20e400bfb273ddac6775a1baa5461b269d/microsoft/durabletask-java/issues/203 |
| og:image:alt | 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 ins... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ScottHamper |
| hostname | github.com |
| expected-hostname | github.com |
| None | d70e31220a67f6376c108d2416fa8e7df854c1065b1672ab7a88ab6dc3a809e2 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/durabletask-java git https://github.com/microsoft/durabletask-java.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 452823832 |
| octolytics-dimension-repository_nwo | microsoft/durabletask-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 452823832 |
| octolytics-dimension-repository_network_root_nwo | microsoft/durabletask-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ccb88d9c92abe69245b429398c8a57ae87070c7c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width