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

Minor race prevention: do not mutate callers' retry policy #1413

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

Groxx
Copy link
Member

@Groxx Groxx commented Dec 13, 2024

Detailed Description

Concurrently calling workflow.WithActivityOptions with a shared retry policy instance that does not set a backoff coefficient can trigger a race because this function mutated it unnecessarily.

The fix is easy: just don't do that :)

Impact Analysis
Fixes tests and prod that share activity-option-vars, which is somewhat common in some codebases. I'm not sure if this can lead to any actual misbehavior since it's a single-word value and it's only ever adjusted to one other value, but I'm fully on board with "never allow races no matter what".

Testing Plan
Test suite should be plenty.

Rollout Plan
Nothing special.

Concurrently calling `workflow.WithActivityOptions` with a shared retry policy instance that does not set a backoff coefficient can trigger a race because this function mutated it unnecessarily.
Easy fix: just don't do that :)
Copy link

codecov bot commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 82.59%. Comparing base (2bceb13) to head (6f53817).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
internal/workflow.go 0.00% 2 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
internal/workflow.go 76.24% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2bceb13...6f53817. Read the comment docs.

@Groxx Groxx merged commit 1fd8ba0 into cadence-workflow:master Dec 13, 2024
10 of 11 checks passed
@Groxx Groxx deleted the race-fix branch December 13, 2024 17:47
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