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
base: master


None yet
2 participants
Copy link

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


This comment has been minimized.

Copy link

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.


This comment has been minimized.

Copy link

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 pull request Jul 22, 2014

Prevent hang on shutdown race.
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 tuxcanfly:fix-addinterrupthandler branch Jul 22, 2014

cjepson added a commit to cjepson/btcd that referenced this pull request May 5, 2016

Reject too low stake difficulty transactions and cache difficulty (bt…

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