-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
Description
A bug has been happening periodically where an exception is thrown:
Exception has occurred: fatal error
"concurrent map read and map write"
It is caused by a concurrent read/write at the validatorsRewardsAggregations map at lines:
goteth/pkg/analyzer/process_state.go
Lines 233 to 241 in 6850ae7
| } | |
| if s.rewardsAggregationEpochs > 1 { | |
| // if validator is not in s.validatorsRewardsAggregations, we need to create it | |
| if _, ok := s.validatorsRewardsAggregations[phase0.ValidatorIndex(valIdx)]; !ok { | |
| s.validatorsRewardsAggregations[phase0.ValidatorIndex(valIdx)] = spec.NewValidatorRewardsAggregation(valIdx, s.startEpochAggregation, s.endEpochAggregation) | |
| } | |
| s.validatorsRewardsAggregations[valIdx].Aggregate(maxRewards) | |
| } | |
| insertValsObj = append(insertValsObj, maxRewards) |
It should be looked into whether it is ok to be processing state transitions concurrently considering that the validatorsRewardsAggregations map contains data corresponding to multiple epochs and a race condition could possibly make it so the aggregations are persited without having correctly aggregated the full epoch range. In case it is ok, then a fix should be implemented to prevent concurrent read/writes, probably with a mutex.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed