Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix activity cancellation race when not cancelling workflow #741

Merged
merged 2 commits into from
Feb 28, 2022

Conversation

cretz
Copy link
Member

@cretz cretz commented Feb 24, 2022

What was changed

Only decrement the in-process cancelled counter during workflow cancel.

Why?

In order to keep the event ID expectations correct, we keep a cancellation counter for things cancelled during workflow execution. This cancellation counter, which has been there for timers and reinstated in #726 for activities, is incremented upon cancel and decremented upon removal of the command. But while the increment was done only during workflow cancellation, the decrement was being done always. This makes sure that decrement is only done during workflow cancellation, when the increment occurs.

Whether we should be limiting the increment to only during workflow cancel done way back in #382, I am unsure.

The reason we saw this issue is during session cancellation which is not workflow cancellation was decrementing that counter too far. This was noticed during #739. So regression tests have been added for them.

@Sushisource
Copy link
Member

Sushisource commented Feb 24, 2022

Whether we should be limiting the increment to only during workflow cancel done way back in #382, I am unsure.

Are you asking whether we should change it to be always?

I do not think so. Since that situation just works properly by default. The intent of my original PR way back was to specifically address the fact that we'd make miscounts only during WF cancellation. I think what's in this PR makes sense.

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.

2 participants