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

miner: Ensure the miner is closed #23675

Conversation

piersy
Copy link
Contributor

@piersy piersy commented Oct 1, 2021

Also make miner and worker wait for goroutines to end at Shutdown.

Without this change, when shutting down its possible for the worker to
try and access the db after it has been closed, which results in a
critical failure and runs the risk of corrupting the db.

@piersy piersy changed the title Ensure the miner is closed miner: Ensure the miner is closed Oct 1, 2021
Also make miner and worker wait for goroutines to end at Shutdown.

Without this change, when shutting down its possible for the worker to
try and access the db after it has been closed, which results in a
critical failure and runs the risk of corrupting the db.
@piersy piersy force-pushed the close-miner-and-wait-for-goroutines-to-exit branch from 082ec8f to 2f01ef3 Compare October 1, 2021 15:45
@holiman
Copy link
Contributor

holiman commented Oct 1, 2021

Heh, this also reminds me of a PR I already have: #21992

@piersy
Copy link
Contributor Author

piersy commented Oct 4, 2021

Heh, this also reminds me of a PR I already have: #21992

Heh, strangely similar, they basically do exactly the same thing :) I prefer yours over mine for the fact that you used a wg in the miner which just keeps the approach consistent, and I prefer mine over yours for the use of function closures to handle the wg which keeps the calls to Add and Done close together in the code. So feel free to close this PR, I don't think its adding anything functionally over your PR.

@fjl
Copy link
Contributor

fjl commented Oct 7, 2021

I will use #21992 because it's older, but thanks a lot for pushing us toward this fix @piersy !

@fjl fjl closed this Oct 7, 2021
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

3 participants