Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

fix tpool locking bug #1555

Merged
merged 1 commit into from Jan 20, 2017
Merged

fix tpool locking bug #1555

merged 1 commit into from Jan 20, 2017

Conversation

lukechampine
Copy link
Member

@lukechampine lukechampine commented Jan 19, 2017

There are two things going on here:

  • ConsensusChange now has a TryTransactionSet field, which is an unexported (i.e. unlocked) version of the consensus set's TryTransactionSet function. This allows the transaction pool to call TryTransactionSet even under lock, namely during ProcessConsensusChange.
  • The consensus set now has an exported method called LockedTryTransactionSet, which read-locks the consensus set and calls the supplied function, passing it an unlocked version of TryTransactionSet. However, this function is not part of the ConsensusSet interface. This allows the transaction pool to call TryTransactionSet multiple times without unlocking the consensus set. More importantly, it means the transaction pool can lock the consensus set first, before locking itself. This prevents a deadlock.

The effect of this is that the defrag test now passes. We may also see less NDFs.

I was just following orders
@DavidVorick
Copy link
Member

yikes, but glad we have it fixed up.

@DavidVorick DavidVorick merged commit 8ba6fe0 into master Jan 20, 2017
@lukechampine lukechampine deleted the hubris branch February 10, 2017 23:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants