Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Data race in swarm/network.TestNetworkID() (kademlia, hive, pot) #1112

@frncmx

Description

@frncmx

How to reproduce?

go test -race -count 1 -run TestNetworkID ./swarm/network

Note: There are 2 race conditions in the following trace.

Stacktrace

WARNING: DATA RACE
Read at 0x00c0000e4a48 by goroutine 16:
  github.com/ethereum/go-ethereum/swarm/network.TestNetworkID()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/swarm/network/networkid_test.go:92 +0x2d8
  testing.tRunner()
      /usr/lib/go/src/testing/testing.go:827 +0x162

Previous write at 0x00c0000e4a48 by goroutine 1157:
  github.com/ethereum/go-ethereum/swarm/network.(*Kademlia).On()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/swarm/network/kademlia.go:268 +0x44e
  github.com/ethereum/go-ethereum/swarm/network.(*Hive).Run()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/swarm/network/hive.go:158 +0xee
  github.com/ethereum/go-ethereum/swarm/network.(*Hive).Run-fm()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/swarm/network/protocol.go:132 +0x4b
  github.com/ethereum/go-ethereum/swarm/network.(*Bzz).RunProtocol.func1()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/swarm/network/protocol.go:191 +0xb9d
  github.com/ethereum/go-ethereum/p2p.(*Peer).startProtocols.func1()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/p2p/peer.go:361 +0x8d

Goroutine 16 (running) created at:
  testing.(*T).Run()
      /usr/lib/go/src/testing/testing.go:878 +0x659
  testing.runTests.func1()
      /usr/lib/go/src/testing/testing.go:1119 +0xa8
  testing.tRunner()
      /usr/lib/go/src/testing/testing.go:827 +0x162
  testing.runTests()
      /usr/lib/go/src/testing/testing.go:1117 +0x4ee
  testing.(*M).Run()
      /usr/lib/go/src/testing/testing.go:1034 +0x2ee
  main.main()
      _testmain.go:106 +0x221

Goroutine 1157 (running) created at:
  github.com/ethereum/go-ethereum/p2p.(*Peer).startProtocols()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/p2p/peer.go:360 +0x2a8
  github.com/ethereum/go-ethereum/p2p.(*Peer).run()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/p2p/peer.go:210 +0x16a
  github.com/ethereum/go-ethereum/p2p.(*Server).runPeer()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/p2p/server.go:1002 +0x25d
==================
==================
WARNING: DATA RACE
Read at 0x00c008d789e8 by goroutine 16:
  github.com/ethereum/go-ethereum/swarm/network.TestNetworkID()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/swarm/pot/pot.go:68 +0x712
  testing.tRunner()
      /usr/lib/go/src/testing/testing.go:827 +0x162

Previous write at 0x00c008d789e8 by goroutine 1157:
  github.com/ethereum/go-ethereum/swarm/pot.Swap()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/swarm/pot/pot.go:85 +0xccc
  github.com/ethereum/go-ethereum/swarm/network.(*Kademlia).On()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/swarm/network/kademlia.go:268 +0x433
  github.com/ethereum/go-ethereum/swarm/network.(*Hive).Run()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/swarm/network/hive.go:158 +0xee
  github.com/ethereum/go-ethereum/swarm/network.(*Hive).Run-fm()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/swarm/network/protocol.go:132 +0x4b
  github.com/ethereum/go-ethereum/swarm/network.(*Bzz).RunProtocol.func1()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/swarm/network/protocol.go:191 +0xb9d
  github.com/ethereum/go-ethereum/p2p.(*Peer).startProtocols.func1()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/p2p/peer.go:361 +0x8d

Goroutine 16 (running) created at:
  testing.(*T).Run()
      /usr/lib/go/src/testing/testing.go:878 +0x659
  testing.runTests.func1()
      /usr/lib/go/src/testing/testing.go:1119 +0xa8
  testing.tRunner()
      /usr/lib/go/src/testing/testing.go:827 +0x162
  testing.runTests()
      /usr/lib/go/src/testing/testing.go:1117 +0x4ee
  testing.(*M).Run()
      /usr/lib/go/src/testing/testing.go:1034 +0x2ee
  main.main()
      _testmain.go:106 +0x221

Goroutine 1157 (running) created at:
  github.com/ethereum/go-ethereum/p2p.(*Peer).startProtocols()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/p2p/peer.go:360 +0x2a8
  github.com/ethereum/go-ethereum/p2p.(*Peer).run()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/p2p/peer.go:210 +0x16a
  github.com/ethereum/go-ethereum/p2p.(*Server).runPeer()
      /home/frncmx/code/src/github.com/ethereum/go-ethereum/p2p/server.go:1002 +0x25d

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions