Skip to content

[WIP] Fix exception when Continue-as-New and Termination happens at the same time#901

Closed
davidmrdavid wants to merge 6 commits intomainfrom
dajusto/patch-continue-as-new-and-terminate-race
Closed

[WIP] Fix exception when Continue-as-New and Termination happens at the same time#901
davidmrdavid wants to merge 6 commits intomainfrom
dajusto/patch-continue-as-new-and-terminate-race

Conversation

@davidmrdavid
Copy link
Collaborator

A feature branch, for testing, containing the community contribution here: #888
This is a fix contributed by @fuifuiyong.

Creating this branch for creating a private package with which to test this, and to perform edits as necessary.

{
ExecutionCompletedEvent executionCompletedEvent;
continuedAsNew = (completeOrchestratorAction.OrchestrationStatus == OrchestrationStatus.ContinuedAsNew);
continuedAsNew = (completeOrchestratorAction.OrchestrationStatus == OrchestrationStatus.ContinuedAsNew) && (runtimeState.OrchestrationStatus != OrchestrationStatus.Terminated);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making a change here, I think it would be better to make a change further upstream in OrchestrationRuntimeState.SetMarkerEvents. Instead of always throwing if we see that ExecutionCompletedEvent == null, we could add an additional check that allows transitioning from a ContinuedAsNew state to the Terminated state. I feel like this is a reasonable thing to allow since termination should be considered forceful.

I'd be fine going even further than this too. I don't see a strong reason to throw an exception if multiple completion events are found as long as we can make the expected outcome predictable. Ideally we'd simply log a warning if we encounter multiple completion events. I feel like failing with an exception is only useful when we don't have a reasonable way to procede.

@torosent
Copy link
Member

torosent commented Jan 9, 2026

Closing stale PR. Please reopen if still relevant.

@torosent torosent closed this Jan 9, 2026
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.

4 participants