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

added a write lock to the txs.filter method and a read lock to the tx… #805

Conversation

thogard785
Copy link
Contributor

The filter method of txSortedMap is typically called by caller that holds the "m" RWLock object.

During reorgs, however, a Filter method of txList calls the filter method of txSortedMap but does not engage the lock.

This Filter method is called only by the txPool methods demoteUnexecutables and promoteExecutables, which are only called during reorgs (which explains the low frequency with which this crash occurs).

Description

Added in a read lock and a write lock

Changes

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)
  • Changes only for a subset of nodes

Nodes audience

This PR is in response to a validator crash

Checklist

  • I have added at least 2 reviewer or the whole pos-v1 team
  • I have added sufficient documentation in code
  • I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply

Additional comments

Have not had time to test this yet but it seemed urgent.

…s.reheap method - both of which are called by Filter during reorg adjustments to txpool
}
l.txs.m.RLock()
defer l.txs.m.RUnlock()
l.txs.reheap()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manav2401 manav2401 mentioned this pull request Apr 4, 2023
16 tasks
@manav2401
Copy link
Contributor

Thanks @thogard785 for the PR. Have picked your commit against another branch to make a release. Please follow #807 for more details. Closing this for now. Thanks again!

@manav2401 manav2401 closed this Apr 4, 2023
@thogard785 thogard785 deleted the txpool-write-locks-on-reorg branch April 10, 2023 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants