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

core: stop chain when tests are finished #27660

Merged
merged 1 commit into from
Jul 6, 2023

Conversation

darioush
Copy link
Contributor

@darioush darioush commented Jul 5, 2023

Adds calls for chain.Stop() to tests that call NewBlockChain

@darioush darioush marked this pull request as ready for review July 5, 2023 16:22
Copy link
Member

@lightclient lightclient left a comment

Choose a reason for hiding this comment

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

It isn't really necessary. The goroutines will be cleaned up by the runtime when the test exits I see that goroutines will sit around until all tests exit, so that could slow other tests down a bit -- journaling isn't relevant because the tests use in-memory databases (and don't reopen them).

Do you know how much faster the core/blockchain tests run with this change?

@darioush
Copy link
Contributor Author

darioush commented Jul 5, 2023

I ran the tests before and after the change, not a notable difference in execution time. The reason for the PR is as you note, the goroutines hang out while other tests are running and it seems better to clean-up resources in tests when not too difficult. Also most other tests call blockchain.Stop.

@ethereum ethereum deleted a comment from 09306677806 Jul 5, 2023
Copy link
Member

@lightclient lightclient left a comment

Choose a reason for hiding this comment

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

Makes sense, appears it is more of an omission to not stop the chain. Thanks for this.

@holiman holiman changed the title core (blockchain_test): add chain.Stop() to tests core: stop chain when tests are finished Jul 6, 2023
@holiman holiman merged commit 83d7f42 into ethereum:master Jul 6, 2023
1 check passed
Copy link

@Georgezhang714 Georgezhang714 left a comment

Choose a reason for hiding this comment

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

georgezhang714

devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
core (blockchain_test): add chain.Stop() to tests
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
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.

4 participants