Skip to content

miner: Ensure the miner is closed#23675

Closed
piersy wants to merge 1 commit intoethereum:masterfrom
piersy:close-miner-and-wait-for-goroutines-to-exit
Closed

miner: Ensure the miner is closed#23675
piersy wants to merge 1 commit intoethereum:masterfrom
piersy:close-miner-and-wait-for-goroutines-to-exit

Conversation

@piersy
Copy link
Copy Markdown
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
Copy Markdown
Contributor

holiman commented Oct 1, 2021

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

@piersy
Copy link
Copy Markdown
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
Copy Markdown
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.

3 participants