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 flakey leak test for ACS Handler #3232

Merged
merged 1 commit into from
Mar 8, 2023
Merged

Conversation

aws-gibbskt
Copy link
Contributor

Summary

The multi-channel multi-goroutine implementation of heartbeatHandling
created a scenario where goroutines would be routinely leaked in the
test which was testing for it.

The reality of handling Heartbeat messages is that there was not a
need to do multi-thread synchronization with channels at all.

Implementation details

The heartbeat handler is now a simple function that dispatches tasks using goroutines and returns.

Testing

Running the once brittle test 100 times (5 runs) after this change had a success rate of 5/5
go test -count=100 -p 1 -v -cover -race -tags unit -coverprofile cover.out -run TestHandlerDoesntLeakGoroutines ./agent/...

Running the test only 100 times (5 runs) before the change had a success rate of: 0/5
go test -count=100 -p 1 v -cover -race -tags unit -coverprofile cover.out -run TestHandlerDoesntLeakGoroutines ./agent/...

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@yinyic yinyic requested review from fierlion June 2, 2022 16:23
Copy link
Contributor

@yinyic yinyic left a comment

Choose a reason for hiding this comment

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

LGTM. Requested review from fierlion@ the original author, in case there's particular reason we chose to use channels for receiving and sending messages.

The multi-channel multi-goroutine implementation of heartbeatHandling
created a scenario where goroutines would be routinely leaked in the
test which was testing for it.

The reality of handling Heartbeat messages is that there was not a
need to do multi-thread synchronization with channels at all.
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.

None yet

6 participants