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

interrupt corner case - addInterruptHandler hangs #154

wants to merge 1 commit into from


Copy link

@tuxcanfly tuxcanfly commented Jul 22, 2014

Found this is in btcsim when rpc client timed out and ^C resulted in a orphaned btcd process.

Seems to be an issue when interrupt is received between two addInterruptHandler calls

Copy link

@davecgh davecgh commented Jul 22, 2014

Negative on this pull request. This would introduce a nasty race. Introducing a global variable that is accessed from multiple goroutines unprotected is the very definition of a race.


Copy link

@davecgh davecgh commented Jul 22, 2014

However, I do see the issue this pull request is pointing out and agree that it should be fixed. I'll have a fix for it shortly that is based on this pull request.


@davecgh davecgh closed this Jul 22, 2014
davecgh added a commit that referenced this issue Jul 22, 2014
This commit prevents a race that could happen on shutdown if a sigint was
received between adding the first the interrupt handler and and future
handlers.  This code is loosely based on initial pull request #154 which
was not accepted due to introducing a race of its own.

Thanks to @tuxcanfly for the intial pull request and finding the issue.
@tuxcanfly tuxcanfly deleted the fix-addinterrupthandler branch Jul 22, 2014
cjepson added a commit to cjepson/btcd that referenced this issue May 5, 2016

The mempool would allow low stake difficulty tickets and then remove
them after the next block was added. This prevents too low difficulty
tickets from being added in the first place. It also refactors some of
the old code in mempool.go, blockmanager.go, and mining.go for
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants