mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-03 11:45:18 +00:00
cs: reset triggered timeout precommit (#3310)
* Reset TriggeredTimeoutPrecommit as part of updateToState
* Add failing test and fix
* fix DATA RACE in TestResetTimeoutPrecommitUponNewHeight
```
WARNING: DATA RACE
Read at 0x00c001691d28 by goroutine 691:
github.com/tendermint/tendermint/consensus.decideProposal()
/go/src/github.com/tendermint/tendermint/consensus/common_test.go:133 +0x121
github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight()
/go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958
testing.tRunner()
/usr/local/go/src/testing/testing.go:827 +0x162
Previous write at 0x00c001691d28 by goroutine 931:
github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState()
/go/src/github.com/tendermint/tendermint/consensus/state.go:562 +0x5b2
github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit()
/go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e
github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit()
/go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e
github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1()
/go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135
github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit()
/go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b
github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote()
/go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e
github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote()
/go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f
github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg()
/go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd
Goroutine 691 (running) created at:
testing.(*T).Run()
/usr/local/go/src/testing/testing.go:878 +0x659
testing.runTests.func1()
/usr/local/go/src/testing/testing.go:1119 +0xa8
testing.tRunner()
/usr/local/go/src/testing/testing.go:827 +0x162
testing.runTests()
testing.(*M).Run()
/usr/local/go/src/testing/testing.go:1034 +0x2ee
main.main()
_testmain.go:216 +0x332
```
* fix another DATA RACE by locking consensus
```
WARNING: DATA RACE
Read at 0x00c009b835a8 by goroutine 871:
github.com/tendermint/tendermint/consensus.(*ConsensusState).createProposalBlock()
/go/src/github.com/tendermint/tendermint/consensus/state.go:955 +0x7c
github.com/tendermint/tendermint/consensus.decideProposal()
/go/src/github.com/tendermint/tendermint/consensus/common_test.go:127 +0x53
github.com/tendermint/tendermint/consensus.TestResetTimeoutPrecommitUponNewHeight()
/go/src/github.com/tendermint/tendermint/consensus/state_test.go:1389 +0x958
testing.tRunner()
/usr/local/go/src/testing/testing.go:827 +0x162
Previous write at 0x00c009b835a8 by goroutine 931:
github.com/tendermint/tendermint/consensus.(*ConsensusState).updateHeight()
/go/src/github.com/tendermint/tendermint/consensus/state.go:446 +0xb7
github.com/tendermint/tendermint/consensus.(*ConsensusState).updateToState()
/go/src/github.com/tendermint/tendermint/consensus/state.go:542 +0x22f
github.com/tendermint/tendermint/consensus.(*ConsensusState).finalizeCommit()
/go/src/github.com/tendermint/tendermint/consensus/state.go:1340 +0x141e
github.com/tendermint/tendermint/consensus.(*ConsensusState).tryFinalizeCommit()
/go/src/github.com/tendermint/tendermint/consensus/state.go:1255 +0x66e
github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit.func1()
/go/src/github.com/tendermint/tendermint/consensus/state.go:1201 +0x135
github.com/tendermint/tendermint/consensus.(*ConsensusState).enterCommit()
/go/src/github.com/tendermint/tendermint/consensus/state.go:1232 +0x94b
github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote()
/go/src/github.com/tendermint/tendermint/consensus/state.go:1657 +0x132e
github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote()
/go/src/github.com/tendermint/tendermint/consensus/state.go:1503 +0x8f
github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg()
/go/src/github.com/tendermint/tendermint/consensus/state.go:694 +0xa1e
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/go/src/github.com/tendermint/tendermint/consensus/state.go:642 +0x948
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
/go/src/github.com/tendermint/tendermint/consensus/state.go:655 +0x7dd
```
* Fix failing test
* Delete profile.out
* fix data races
This commit is contained in:
committed by
Anton Kaliaev
parent
0b0a8b3128
commit
af8793c01a
@@ -124,15 +124,21 @@ func startTestRound(cs *ConsensusState, height int64, round int) {
|
||||
|
||||
// Create proposal block from cs1 but sign it with vs
|
||||
func decideProposal(cs1 *ConsensusState, vs *validatorStub, height int64, round int) (proposal *types.Proposal, block *types.Block) {
|
||||
cs1.mtx.Lock()
|
||||
block, blockParts := cs1.createProposalBlock()
|
||||
cs1.mtx.Unlock()
|
||||
if block == nil { // on error
|
||||
panic("error creating proposal block")
|
||||
}
|
||||
|
||||
// Make proposal
|
||||
polRound, propBlockID := cs1.ValidRound, types.BlockID{block.Hash(), blockParts.Header()}
|
||||
cs1.mtx.RLock()
|
||||
validRound := cs1.ValidRound
|
||||
chainID := cs1.state.ChainID
|
||||
cs1.mtx.RUnlock()
|
||||
polRound, propBlockID := validRound, types.BlockID{block.Hash(), blockParts.Header()}
|
||||
proposal = types.NewProposal(height, round, polRound, propBlockID)
|
||||
if err := vs.SignProposal(cs1.state.ChainID, proposal); err != nil {
|
||||
if err := vs.SignProposal(chainID, proposal); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user