Skip to content

Fix contradictory retry behavior in .NET first-program tutorial #5044

Description

@collinstevens

Documentation page

Run your first Temporal application with the .NET SDK

Problem

The “Recover from an unknown error in an Activity” demonstration does not match the retry policy shown earlier on the same page:

var retryPolicy = new RetryPolicy
{
    InitialInterval = TimeSpan.FromSeconds(1),
    MaximumInterval = TimeSpan.FromSeconds(100),
    BackoffCoefficient = 2,
    MaximumAttempts = 3,
    NonRetryableErrorTypes = new[] { "InvalidAccountException", "InsufficientFundsException" }
};

There are several related inconsistencies:

  1. MaximumAttempts = 3 permits three total Activity attempts, including the initial attempt. It does not mean three retries.
  2. The tutorial says the Worker/Workflow “keeps retrying” DepositAsync and shows more than three deposit executions. That output is impossible with this retry policy.
  3. After the third failed deposit attempt, ExecuteActivityAsync fails and the Workflow enters its refund handling. Therefore, the later instructions to fix the Activity, restart the Worker, and wait for the “next scheduled attempt” cannot work as written.
  4. The page says that code is retried forever unless a ScheduleToCloseTimeout or StartToCloseTimeout is specified. StartToCloseTimeout limits each individual attempt; it does not limit the total duration across retries. ScheduleToCloseTimeout is the overall Activity timeout.
  5. The wording attributes retries to the Worker/Workflow. More precisely, the Temporal Service schedules subsequent Activity Tasks according to the Retry Policy, and a Worker executes those tasks. The Worker process continuing to poll is distinct from an Activity having unlimited retry attempts.

Expected behavior

The prose, sample output, and code should describe the same retry behavior, and the live-debugging exercise should leave a pending retry after the user fixes and restarts the Worker.

Suggested fixes

Either:

  • remove MaximumAttempts = 3 (or set it to 0) for this live-debugging demonstration so retries remain unlimited; or
  • rewrite the demonstration to show exactly three attempts followed by the refund path.

Also:

  • describe MaximumAttempts = 3 as three total attempts;
  • remove StartToCloseTimeout from the statement about limiting the overall retry duration; and
  • distinguish a Worker continuing to poll from an Activity continuing to retry.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions