Process crashes and hangs when passing parameters that contain CancellationToken

Open
#1,158 7 comments 1 reaction 1 assignee View on GitHub

@AnatoliB is already working on this.

Since Nov 12, 2025.

Assessment

This issue has not been assessed yet.

Description

P2 reviewed

There have been several reports of CLR crashes and process hangs when using DTFx, specifically when a call to an activity function, continue-as-new, etc. passes in a parameter that contains a reference to CancellationToken. This also happens when OrchestrationContext.CreateClient<T> is used and methods in T interface with CancellationToken in their signatures.

The root issue is that the serialization code used by DTFx will serialize CancellationToken objects in a way that can corrupt CLR memory, resulting in unexpected behavior.

The mitigation is to remove CancellationToken parameters from interfaces that are wrapped using OrchestrationContext.CreateClient<T> or from argument values that are passed to ScheduleTask*, ContinueAsNew, etc.

Dominant language
C#
Stars
1.7k
Forks
335
Avg merge
4d 2h
Merged PRs (30d)
6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/durabletask

All issues in Azure/durabletask

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.