-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fixes #1762 segfault when miner is interrupted. #1778
Conversation
Performed testing of this PR on mainnet by running zcashd in gdb with and without the patch, using zcash-cli to enable and disable the miner, and then wait for a new block to arrive and either crash (without patch) or continue as normal (with patch). |
@@ -648,12 +648,10 @@ void static BitcoinMiner(CWallet *pwallet) | |||
catch (const boost::thread_interrupted&) | |||
{ | |||
LogPrintf("ZcashMiner terminated\n"); | |||
throw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AIUI this is technically wrong; Boost requires that you re-throw boost::thread_interrupted
so that higher-level code can catch it.
Running ./zcash-cli setgenerate false would result in a segfault. The miner thread's boost::signals2::connection was not disconnected when the miner thread was interrupted and shutdown. Subsequently, when a new block arrived, the UpdateTip callback would still be invoked on a now invalid object, resulting in a segfault.
fd9ade8
to
5e9b555
Compare
utACK |
1 similar comment
utACK |
@zkbot r+ |
📌 Commit 5e9b555 has been approved by |
☀️ Test successful - zcash |
Closes #1762