Skip to content

Data race via txpool #25869

Closed
Closed
@holiman

Description

@holiman

Detected by travis cron

WARNING: DATA RACE
Read at 0x00c000426348 by goroutine 87:
  github.com/ethereum/go-ethereum/core.(*TxPool).Nonce()
      /home/travis/gopath/src/github.com/ethereum/go-ethereum/core/tx_pool.go:466 +0xe8
  github.com/ethereum/go-ethereum/miner.(*testWorkerBackend).newRandomTx()
      /home/travis/gopath/src/github.com/ethereum/go-ethereum/miner/worker_test.go:194 +0x7d
  github.com/ethereum/go-ethereum/miner.testGenerateBlockAndImport()
      /home/travis/gopath/src/github.com/ethereum/go-ethereum/miner/worker_test.go:251 +0x8b7
  github.com/ethereum/go-ethereum/miner.TestGenerateBlockAndImportEthash()
      /home/travis/gopath/src/github.com/ethereum/go-ethereum/miner/worker_test.go:210 +0x30
  testing.tRunner()
      /home/travis/.gimme/versions/go1.19.1.linux.amd64/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /home/travis/.gimme/versions/go1.19.1.linux.amd64/src/testing/testing.go:1493 +0x47

Previous write at 0x00c000426348 by goroutine 111:
  github.com/ethereum/go-ethereum/core.(*TxPool).reset()
      /home/travis/gopath/src/github.com/ethereum/go-ethereum/core/tx_pool.go:1291 +0xe3c
  github.com/ethereum/go-ethereum/core.(*TxPool).runReorg()
      /home/travis/gopath/src/github.com/ethereum/go-ethereum/core/tx_pool.go:1155 +0x373
  github.com/ethereum/go-ethereum/core.(*TxPool).scheduleReorgLoop.func2()
      /home/travis/gopath/src/github.com/ethereum/go-ethereum/core/tx_pool.go:1084 +0x71
// Nonce returns the next nonce of an account, with all transactions executable
// by the pool already applied on top.
func (pool *TxPool) Nonce(addr common.Address) uint64 {
	return pool.pendingNonces.get(addr) //           <- THIS LINE
}
	pool.currentState = statedb
	pool.pendingNonces = newTxNoncer(statedb)   <-- PREVIOUS WRITE
	pool.currentMaxGas = newHead.GasLimit

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions