Skip to content

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

Open
@Neutroni

Description

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

Metadata

Assignees

No one assigned

    Labels

    P2Priority 2 itemReliabilityDurable functions get stuck or don’t run as expected.programming model 🚀

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions