Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

waitForExternalEvent not completing in reasonable time when event arrives early #558

Open
Neutroni opened this issue Nov 6, 2023 · 0 comments
Labels
P2 Priority 2 item programming model 🚀 Reliability Durable functions get stuck or don’t run as expected.

Comments

@Neutroni
Copy link

Neutroni commented Nov 6, 2023

Describe the bug
context.df.waitForExternalEvent() in context.df.Task.any() does not complete quickly in case the event arrives too early or in some cases seemingly at all.
We have a system where durable orchestrator calls activity function which calls external service which starts some processes one of which will send the event trough httpTrigger but in case the external server and the activity function return later than the started process triggers the event we are seeing long waits for waitForExternalEvent in the orchestrator. With durable-functions npm module version 1.5.4 same code completes instantly but with versions 2 and later the event does not trigger correctly.

Investigative information

  • Durable Functions extension version: [3.3.0, 4.0.0)
  • durable-functions npm module version: 2.1.3
  • Language (JavaScript/TypeScript) and version: TypeScript 5.2.2
  • Node.js version: ~16

To Reproduce
Have orchestrator which waits for event and calls activity function where the activity function triggers the event, see sample code for example.

Orchestrator source code (minimal example):
index.ts

Activity function source code (minimal example):
index.ts

In the sample code the context.df.Task.any() seemingly completes when timeout task completes but the waitForExternalEvent task wins since it received event long before. Modify duration of deadline task to see it changing when waitForExternalEvent completes, or remove the deadline task from the Task.any and code seemingly never completes

Expected behavior
context.df.waitForExternalEvent() in context.df.Task.any() completes quickly when waitForExternalEvent has received the event.

Actual behavior
context.df.waitForExternalEvent() in context.df.Task.any() completes when other task in Task.any() completes or in case there is not other task seemingly never.

Additional context

  • Development environment: Visual Studio Code
@lilyjma lilyjma added programming model 🚀 Reliability Durable functions get stuck or don’t run as expected. P2 Priority 2 item labels Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Priority 2 item programming model 🚀 Reliability Durable functions get stuck or don’t run as expected.
Projects
None yet
Development

No branches or pull requests

2 participants