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

accounts: add walletsNoLock to avoid double read lock #20655

Merged
merged 2 commits into from
Feb 12, 2020
Merged

accounts: add walletsNoLock to avoid double read lock #20655

merged 2 commits into from
Feb 12, 2020

Conversation

BurtonQin
Copy link
Contributor

As the https://golang.org/pkg/sync/ says about RLock:
It should not be used for recursive read locking; a blocked Lock call excludes new readers from acquiring the lock.
So double read lock should also be avoided.
The first RLock is am.lock.RLock() in func Wallet(), the second RLock is in its callee func Wallets().
The fix is to add a new func walletsNoLock() and let Wallet() and Wallets() call it.

@fjl fjl changed the title Let Wallet call walletsNoLock to avoid double read lock accounts: add walletsNoLock to avoid double read lock Feb 12, 2020
@fjl fjl merged commit 5f2002b into ethereum:master Feb 12, 2020
enriquefynn pushed a commit to enriquefynn/go-ethereum that referenced this pull request Mar 10, 2021
gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request Jan 3, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 3, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 4, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 6, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 7, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 7, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 7, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 9, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 10, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 10, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 10, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 10, 2025
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.

2 participants