Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/durabletask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@ permissions:
contents: read

jobs:
async-runtime-windows:
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
runs-on: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Install runtime test dependencies
run: |
python -m pip install --upgrade "pip>=25.1"
python -m pip install --group test -e .
- name: Check asyncio, replay, and dispatch cleanup
run: >-
python -m pytest
tests\durabletask\test_asyncio_orchestrators.py
tests\durabletask\test_coroutine_orchestrators.py
tests\durabletask\test_orchestration_generator_cleanup.py
tests\durabletask\test_orchestration_dispatch_recovery.py
-q

lint-and-unit-tests:
runs-on: ubuntu-latest
steps:
Expand Down
33 changes: 27 additions & 6 deletions docs/async-orchestrators.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,27 +320,48 @@ Every dispatch reconstructs the coroutine and its local tasks from history.
After the response and entity-release obligations are snapshotted, teardown
cancels remaining local tasks, drains cooperative cleanup, closes tracked async
generators, and disposes the loop. This includes dispatches that suspend,
continue as new, encounter a history failure, or reject a version.
continue as new, encounter a history failure, or reject a version. An async
generator whose `anext()` is still in progress is closed after that step
finishes. A coroutine that ignores cancellation is closed last, still on the
dispatch loop and in its task's context; it cannot start a new async generator
there, because no later sweep could close it.

Local cleanup can await ready work such as `sleep(0)`; it must not wait for new
durable or external work.
Scheduling/awaiting durable work during async teardown raises an actionable
error. Teardown must cooperate with cancellation; a non-quiescent cleanup
queue is bounded and reported, not allowed to run indefinitely.
Scheduling/awaiting durable work, or waiting for or receiving an external
event, during async teardown raises an actionable error. Teardown must
cooperate with cancellation.

> [!WARNING]
> Async teardown is capped at about 10,000 event-loop steps per cleanup phase
> (more for dispatches with many tasks or async generators). Cleanup that is
> still running when the cap is reached is truncated: remaining callbacks are
> dropped, unfinished coroutines are closed, and a warning is logged. The
> response decided before teardown is unchanged. Each async-generator sweep's
> budget is fixed at sweep entry; tasks or generators created during that sweep
> cannot increase it. The cap bounds cooperative scheduling steps, not
> wall-clock time or code that never yields.

Ordinary teardown failures (including `CancelledError`) are logged without
changing the decided response or skipping other cooperative finalizers.
Unexpected non-cancellation `BaseException`
exits retain the existing terminal-failure/recovery policy; an existing primary
failure is preserved. Teardown status/actions do not replace the response.
Held entity-release obligations are captured before teardown for terminal
payload/failure handling.
payload/failure handling. Exiting an entity critical section during teardown
does not schedule additional release messages, and a `SystemExit` or
`KeyboardInterrupt` raised by any finalizer takes precedence over other
cleanup failures.

Keep workflow cleanup that must be durable in **normal orchestration control
flow**, before return or continue-as-new, not solely in a dispatch finalizer.
No cleanup is guaranteed after process crash or forced termination.
Async-generator *helpers* are closed; async-generator *orchestrators*
(`async def` containing `yield`) are rejected.
(`async def` containing `yield`) are rejected. The dispatch owns every async
generator it starts until teardown, including generators first iterated by
another generator's cleanup. To run a generator's cleanup earlier, close it
explicitly with `await gen.aclose()` or iterate it inside
`contextlib.aclosing(...)`.

## Replay and framework adapters

Expand Down
Loading