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

Fixes #1762 segfault when miner is interrupted. #1778

Merged
merged 1 commit into from
Nov 6, 2016

Conversation

bitcartel
Copy link
Contributor

Closes #1762

@bitcartel bitcartel added C-bug Category: This is a bug A-pow Area: Proof-of-Work and mining labels Nov 4, 2016
@bitcartel bitcartel added this to the 1.0.2 milestone Nov 4, 2016
@bitcartel bitcartel self-assigned this Nov 4, 2016
@bitcartel
Copy link
Contributor Author

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;
Copy link
Contributor

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.
@bitcartel bitcartel added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 4, 2016
@str4d
Copy link
Contributor

str4d commented Nov 4, 2016

utACK

1 similar comment
@daira
Copy link
Contributor

daira commented Nov 5, 2016

utACK

@str4d str4d removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 5, 2016
@str4d
Copy link
Contributor

str4d commented Nov 5, 2016

@zkbot r+

@zkbot
Copy link
Contributor

zkbot commented Nov 5, 2016

📌 Commit 5e9b555 has been approved by str4d

@zkbot
Copy link
Contributor

zkbot commented Nov 5, 2016

⌛ Testing commit 5e9b555 with merge 2648902...

zkbot pushed a commit that referenced this pull request Nov 5, 2016
Fixes #1762 segfault when miner is interrupted.

Closes #1762
@str4d str4d modified the milestones: 1.0.3, 1.0.2 Nov 5, 2016
@zkbot
Copy link
Contributor

zkbot commented Nov 6, 2016

☀️ Test successful - zcash

@zkbot zkbot merged commit 5e9b555 into zcash:master Nov 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pow Area: Proof-of-Work and mining C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants