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

core/state: remove lock #18065

Merged
merged 1 commit into from
Nov 8, 2018
Merged

core/state: remove lock #18065

merged 1 commit into from
Nov 8, 2018

Conversation

fjl
Copy link
Contributor

@fjl fjl commented Nov 8, 2018

The lock in StateDB is useless. It's only held in Copy, but Copy is safe
for concurrent use because all it does is read.

The lock in StateDB is useless. It's only held in Copy, but Copy is safe
for concurrent use because all it does is read.
@holiman
Copy link
Contributor

holiman commented Nov 8, 2018

I agree it's useless as is. Question though: instead of removing it for Copy, perhaps it ought to be used for operations that write?

@fjl
Copy link
Contributor Author

fjl commented Nov 8, 2018

No, because StateDB is not safe for concurrent use. The correct way to use StateDB is doing all modifications from a single goroutine at a time and copying the DB if it is to be passed to a different goroutine. We use this pattern for the pending state.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

Ok then, here's a 👍 for ya

@fjl fjl merged commit 870efee into ethereum:master Nov 8, 2018
@karalabe karalabe added this to the 1.8.18 milestone Nov 9, 2018
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