Skip to content

馃挜 Preserve non-cancellable timed promise waits during cancellation - #3029

Draft
Quinn-With-Two-Ns wants to merge 1 commit into
temporalio:mainfrom
Quinn-With-Two-Ns:issue-3026
Draft

馃挜 Preserve non-cancellable timed promise waits during cancellation#3029
Quinn-With-Two-Ns wants to merge 1 commit into
temporalio:mainfrom
Quinn-With-Two-Ns:issue-3026

Conversation

@Quinn-With-Two-Ns

Copy link
Copy Markdown
Contributor

What was changed

This change adds the DETACH_NON_CANCELLABLE_PROMISE_GET_TIMER SDK flag and updates timed, non-cancellable Promise.get(timeout, unit) calls to run their timeout timer in a detached cancellation scope. The timer is canceled after the promise completes. Regression and replay tests cover promise completion, timeouts, activity cancellation, child workflow cancellation, and combinations with CANCEL_AWAIT_TIMER_ON_CONDITION. The activity tests use per-test latches for deterministic synchronization.

Why?

Promise.get(timeout, unit) is non-cancellable, but cancellation of its enclosing scope previously canceled its timeout timer. This ended the wait early and incorrectly surfaced a TimeoutException, potentially hiding the actual activity or child workflow cancellation. The new SDK flag preserves replay compatibility for existing workflow histories while allowing new workflows to use the corrected behaviour.

馃挜 Breaking changes

This change can affect workflow behaviour because timed, non-cancellable Promise.get(timeout, unit) calls will no longer return early with a TimeoutException when their enclosing cancellation scope is canceled. Instead, they will continue waiting until the promise completes, fails, or reaches its actual timeout. Workflows that currently catch the premature TimeoutException and use it to select a control flow path may therefore produce different results. The behaviour is protected by an SDK flag so existing workflow histories retain their original behaviour during replay, while new workflows can adopt the corrected semantics without causing nondeterminism.

Checklist

  1. Closes Promise.get(timeout, unit) throws a misleading TimeoutException when the workflow is canceled聽#3026

  2. How was this tested:

  1. Any docs updates needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Promise.get(timeout, unit) throws a misleading TimeoutException when the workflow is canceled

1 participant