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

Store activity result on graceful worker stop #579

Merged
merged 4 commits into from
Oct 18, 2021

Conversation

cretz
Copy link
Member

@cretz cretz commented Oct 8, 2021

What was changed

Allow activity result handling to complete even on worker stop. Also determined flaky test was due to retry throttler not being allowed to exit early, so fixed that (side effect being that all worker stops happen much faster now).

Why?

Activity results were not getting stored on worker stop

Checklist

  1. Closes Activity result is not stored (and continued) when stopping worker gracefully #480

…aceful-shutdown

# Conflicts:
#	test/integration_test.go
@@ -881,11 +881,6 @@ func (atp *activityTaskPoller) ProcessTask(task interface{}) error {
return nil
}

// if worker is stopping, don't bother reporting activity completion
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious to know why this was there.

Copy link
Member Author

Choose a reason for hiding this comment

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

Me too, it dates back to the very first creation of integration tests in cadence, see https://github.com/cretz/sdk-go/blame/a115d469e80ed5c9f38f0c3a2183a11d16fb2dd5/internal/internal_task_pollers.go#L890

Comment on lines +175 to +177
if strings.Contains(ts.T().Name(), "GracefulActivityCompletion") {
options.WorkerStopTimeout = 10 * time.Second
}
Copy link
Member

Choose a reason for hiding this comment

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

I tried and failed to find a more organized way to do this than checking test names which makes me want to 🤮

You know Go much better than I, though, so if there's a reasonably easy way you see to fix that, please do.

Copy link
Member Author

Choose a reason for hiding this comment

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

The proper way IMO is to have tests instantiate their harnesses instead of the other way around, but testify (and the whole junit-style of lifecycle management) tends to encourage non-test-specific setup so without inverting control here, this is about as good as you can do I think.

@cretz
Copy link
Member Author

cretz commented Oct 8, 2021

@vitarb or @Sushisource - my build is failing only when cache is disabled yet it is unclear why. It can be replicated by running:

WORKFLOW_CACHE_SIZE=0 go test -v --count 1 ./test -run 'TestIntegrationSuite/TestLocalActivityRetryBehavior$'

However, this failure is also occurring for me on master but not Buildkite. Can either of y'all replicate and/or have any ideas? Thanks

@cretz
Copy link
Member Author

cretz commented Oct 14, 2021

The failing test is failing in master and will be fixed in #589.

@cretz cretz merged commit e38f09d into temporalio:master Oct 18, 2021
@cretz cretz deleted the activity-graceful-shutdown branch October 18, 2021 20:07
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.

Activity result is not stored (and continued) when stopping worker gracefully
3 participants