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 context cancellation race condition #721

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

cretz
Copy link
Member

@cretz cretz commented Feb 9, 2022

What was changed

We lock context fields potentially used by multiple goroutines and we make sure context.cancel is only called once.

Why?

Before there were situations (run tests with -race) where context variables were accessed concurrently without mutexes which could cause context cancel to run twice unintentionally.

Checklist

  1. Closes Coroutine/context cancellation race conditions #720

Copy link
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

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

Can we add the race flag to UTs in CI? (if it's not already)

@cretz
Copy link
Member Author

cretz commented Feb 9, 2022

@Sushisource - this flag is already set in CI (CI uses make unit-test which uses the TEST_ARG that has that value set). These tests would have failed CI without the accompanying fix.

@cretz cretz merged commit 1837657 into temporalio:master Feb 9, 2022
@cretz cretz deleted the cancel-race branch February 9, 2022 20:30
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.

Coroutine/context cancellation race conditions
2 participants