Skip to content

Conversation

matthew-alexander-partior

Problem

During execution such as simulation calls, Quorum attempts to copy the state trie from stateDb.go via a goroutine, this involves copying the logs mapping from stateDb

Inside the stateDb Copy() function, it acquires a mutex but releases it just before copying the logs mapping which was introduced in this [PR] https://github.com/Consensys/quorum/pull/1331/files#diff-c3757dc9e9d868f63bc84a0cc67159c1d5c22cc5d8c9468757098f0492e0658c)

With no guard in place for logs mapping, we experienced a race condition when accessing & writing to logs as seen below

fatal error: concurrent map iteration and map write

goroutine 22214 [running]:
github.com/ethereum/go-ethereum/core/state.(*StateDB).Copy(0xc000f216c0)
	github.com/ethereum/go-ethereum/core/state/statedb.go:869 +0xae5

Solution

This PR replaces logs implementation of map with sync.Map to ensure accessing / modifying logs is done in a concurrency safe manner

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