This repository has been archived by the owner on Sep 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
txpool: sync.Mutex instead of RWMutex (#735)
[simplelru](https://github.com/hashicorp/golang-lru/tree/master/simplelru) is not thread safe. During the `Get` operation, the recentness of the accessed item is updated, so it is not a pure read-operation. Therefore, the mutex we need to protect the LRUs in txpool is a full mutex, not `RLock`. See erigontech/erigon#4679 (comment) and ethereum/go-ethereum#26164. Also, RWMutex has a performance overhead compared with the vanilla one (see, for example, golang/go#38813). Kudos to Martin Swende for pointing to the issue.
- Loading branch information
Showing
1 changed file
with
29 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters