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

Ensure scanner scavenger stops in tests #5510

Merged

Conversation

3vilhamster
Copy link
Member

What changed?
Ensure that scvngr is stopped if the test scenario times out.

Why?
If the test scenario will somehow take more than 10 seconds the test will fail, but can leak goroutine. So I ensure that the suite does the cleanup.

How did you test it?

Potential risks

Release notes

Documentation Changes

Comment on lines +195 to 198
defer s.scvgr.Stop()
timer := time.NewTimer(scavengerTestTimeout)
select {
case <-s.scvgr.stopped:
Copy link
Member

@Groxx Groxx Dec 21, 2023

Choose a reason for hiding this comment

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

main caveat here is probably that, if it's in a live/dead-lock of some kind, it'll sit idle for N minutes until the whole test suite times out... though I guess it fails either way.

maybe that's better? does a timeout give you running goroutines? and do we have a reasonably-short go test-level timeout set, e.g. ideally 1 minute?

Copy link
Member

@Groxx Groxx Dec 21, 2023

Choose a reason for hiding this comment

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

looks like:

  • yep, timeouts print stacks. should help find the issue when it occurs 👍
  • outside the host/ndc folder (which has 20m), we have no specified timeout, which means currently "the whole package can test for 10? 30? minutes". and a small forever-blocking local test agrees with that, it's much longer than a minute at least.

so:

  • 👍 yep I like this
  • mind adding a default 1m timeout to all go tests in the makefile?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure that we can broadly state that our test will timeout in 1m. I'd say we can try setting to 5m. I'll create a separate PR for this experiment.

Copy link
Member

@Groxx Groxx Dec 21, 2023

Choose a reason for hiding this comment

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

my manual test took 10m to finish, so that's apparently the default (and all the "the default is 30m" and "the default is 1m" that google finds are likely coming from discussion in golang/go#48157, and are not actually the defaults)

Copy link
Member

@Groxx Groxx Dec 21, 2023

Choose a reason for hiding this comment

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

broadly state a 1m timeout: yea. might not be good enough / a separate PR is fine IMO.
we can also selectively reduce the timeout (but I think not add?) with t.SetTimeout which might be good for these. long timeouts that eventually fail at an "obviously this could be caught MUCH earlier" are just really painful :\

@3vilhamster 3vilhamster merged commit 6bd9a95 into cadence-workflow:master Dec 21, 2023
16 checks passed
@3vilhamster 3vilhamster deleted the ensure-scavenger-stop branch December 22, 2023 09:10
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