Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

data race with relevant stack trace #53

Closed
fxfactorial opened this issue Apr 22, 2020 · 6 comments
Closed

data race with relevant stack trace #53

fxfactorial opened this issue Apr 22, 2020 · 6 comments
Assignees

Comments

@fxfactorial
Copy link

==================
WARNING: DATA RACE
Read at 0x00c000ee4000 by goroutine 428:
  math/rand.(*rngSource).Uint64()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rng.go:239 +0x3e
  math/rand.(*rngSource).Int63()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rng.go:234 +0x1d0
  math/rand.(*Rand).Int63()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rand.go:85 +0x8f
  math/rand.(*Rand).Int63n()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rand.go:117 +0x51
  github.com/libp2p/go-libp2p-discovery.FullJitter()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoff.go:33 +0x5f
  github.com/libp2p/go-libp2p-discovery.(*exponentialBackoff).Delay()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoff.go:169 +0x1a4
  github.com/libp2p/go-libp2p-discovery.findPeerDispatcher.func1()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:186 +0x1c8
  github.com/libp2p/go-libp2p-discovery.findPeerDispatcher()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:198 +0x6d5

Previous write at 0x00c000ee4000 by goroutine 593:
  math/rand.(*rngSource).Uint64()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rng.go:239 +0x54
  math/rand.(*rngSource).Int63()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rng.go:234 +0x1d0
  math/rand.(*Rand).Int63()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rand.go:85 +0x8f
  math/rand.(*Rand).Int63n()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rand.go:117 +0x51
  github.com/libp2p/go-libp2p-discovery.FullJitter()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoff.go:33 +0x5f
  github.com/libp2p/go-libp2p-discovery.(*exponentialBackoff).Delay()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoff.go:169 +0x1a4
  github.com/libp2p/go-libp2p-discovery.findPeerDispatcher.func1()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:186 +0x1c8
  github.com/libp2p/go-libp2p-discovery.findPeerDispatcher()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:198 +0x6d5

Goroutine 428 (running) created at:
  github.com/libp2p/go-libp2p-discovery.(*BackoffDiscovery).FindPeers()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:156 +0x86b
  github.com/libp2p/go-libp2p-pubsub.(*pubSubDiscovery).FindPeers()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:327 +0x1be
  github.com/libp2p/go-libp2p-pubsub.(*discover).handleDiscovery()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:302 +0x13a
  github.com/libp2p/go-libp2p-pubsub.(*discover).discoverLoop.func1()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:160 +0x10a

Goroutine 593 (finished) created at:
  github.com/libp2p/go-libp2p-discovery.(*BackoffDiscovery).FindPeers()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:156 +0x86b
  github.com/libp2p/go-libp2p-pubsub.(*pubSubDiscovery).FindPeers()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:327 +0x1be
  github.com/libp2p/go-libp2p-pubsub.(*discover).handleDiscovery()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:302 +0x13a
  github.com/libp2p/go-libp2p-pubsub.(*discover).discoverLoop.func1()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:160 +0x10a
==================
==================
WARNING: DATA RACE
Read at 0x00c000ee4008 by goroutine 428:
  math/rand.(*rngSource).Uint64()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rng.go:244 +0x8e
  math/rand.(*rngSource).Int63()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rng.go:234 +0x1d0
  math/rand.(*Rand).Int63()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rand.go:85 +0x8f
  math/rand.(*Rand).Int63n()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rand.go:117 +0x51
  github.com/libp2p/go-libp2p-discovery.FullJitter()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoff.go:33 +0x5f
  github.com/libp2p/go-libp2p-discovery.(*exponentialBackoff).Delay()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoff.go:169 +0x1a4
  github.com/libp2p/go-libp2p-discovery.findPeerDispatcher.func1()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:186 +0x1c8
  github.com/libp2p/go-libp2p-discovery.findPeerDispatcher()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:198 +0x6d5

Previous write at 0x00c000ee4008 by goroutine 593:
  math/rand.(*rngSource).Uint64()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rng.go:244 +0xaa
  math/rand.(*rngSource).Int63()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rng.go:234 +0x1d0
  math/rand.(*Rand).Int63()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rand.go:85 +0x8f
  math/rand.(*Rand).Int63n()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rand.go:117 +0x51
  github.com/libp2p/go-libp2p-discovery.FullJitter()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoff.go:33 +0x5f
  github.com/libp2p/go-libp2p-discovery.(*exponentialBackoff).Delay()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoff.go:169 +0x1a4
  github.com/libp2p/go-libp2p-discovery.findPeerDispatcher.func1()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:186 +0x1c8
  github.com/libp2p/go-libp2p-discovery.findPeerDispatcher()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:198 +0x6d5

Goroutine 428 (running) created at:
  github.com/libp2p/go-libp2p-discovery.(*BackoffDiscovery).FindPeers()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:156 +0x86b
  github.com/libp2p/go-libp2p-pubsub.(*pubSubDiscovery).FindPeers()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:327 +0x1be
  github.com/libp2p/go-libp2p-pubsub.(*discover).handleDiscovery()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:302 +0x13a
  github.com/libp2p/go-libp2p-pubsub.(*discover).discoverLoop.func1()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:160 +0x10a

Goroutine 593 (finished) created at:
  github.com/libp2p/go-libp2p-discovery.(*BackoffDiscovery).FindPeers()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:156 +0x86b
  github.com/libp2p/go-libp2p-pubsub.(*pubSubDiscovery).FindPeers()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:327 +0x1be
  github.com/libp2p/go-libp2p-pubsub.(*discover).handleDiscovery()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:302 +0x13a
  github.com/libp2p/go-libp2p-pubsub.(*discover).discoverLoop.func1()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:160 +0x10a
==================
==================
WARNING: DATA RACE
Read at 0x00c000ffa000 by goroutine 680:
  math/rand.(*rngSource).Uint64()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rng.go:239 +0x3e
  math/rand.(*rngSource).Int63()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rng.go:234 +0x1d0
  math/rand.(*Rand).Int63()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rand.go:85 +0x8f
  math/rand.(*Rand).Int63n()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rand.go:117 +0x51
  github.com/libp2p/go-libp2p-discovery.FullJitter()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoff.go:33 +0x5f
  github.com/libp2p/go-libp2p-discovery.(*exponentialBackoff).Delay()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoff.go:169 +0x1a4
  github.com/libp2p/go-libp2p-discovery.findPeerDispatcher.func1()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:186 +0x1c8
  github.com/libp2p/go-libp2p-discovery.findPeerDispatcher()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:198 +0x6d5

Previous write at 0x00c000ffa000 by goroutine 618:
  math/rand.(*rngSource).Uint64()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rng.go:239 +0x54
  math/rand.(*rngSource).Int63()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rng.go:234 +0x1d0
  math/rand.(*Rand).Int63()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rand.go:85 +0x8f
  math/rand.(*Rand).Int63n()
      /home/edgar/.gimme/versions/go1.14.1.linux.amd64/src/math/rand/rand.go:117 +0x51
  github.com/libp2p/go-libp2p-discovery.FullJitter()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoff.go:33 +0x5f
  github.com/libp2p/go-libp2p-discovery.(*exponentialBackoff).Delay()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoff.go:169 +0x1a4
  github.com/libp2p/go-libp2p-discovery.findPeerDispatcher.func1()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:186 +0x1c8
  github.com/libp2p/go-libp2p-discovery.findPeerDispatcher()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:198 +0x6d5

Goroutine 680 (running) created at:
  github.com/libp2p/go-libp2p-discovery.(*BackoffDiscovery).FindPeers()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:156 +0x86b
  github.com/libp2p/go-libp2p-pubsub.(*pubSubDiscovery).FindPeers()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:327 +0x1be
  github.com/libp2p/go-libp2p-pubsub.(*discover).handleDiscovery()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:302 +0x13a
  github.com/libp2p/go-libp2p-pubsub.(*discover).discoverLoop.func1()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:160 +0x10a

Goroutine 618 (finished) created at:
  github.com/libp2p/go-libp2p-discovery.(*BackoffDiscovery).FindPeers()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-discovery@v0.3.0/backoffcache.go:156 +0x86b
  github.com/libp2p/go-libp2p-pubsub.(*pubSubDiscovery).FindPeers()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:327 +0x1be
  github.com/libp2p/go-libp2p-pubsub.(*discover).handleDiscovery()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:302 +0x13a
  github.com/libp2p/go-libp2p-pubsub.(*discover).discoverLoop.func1()
      /home/edgar/go/pkg/mod/github.com/libp2p/go-libp2p-pubsub@v0.2.7/discovery.go:160 +0x10a
@Stebalien
Copy link
Member

@aschmahmann could you pick this up? I'd like to get a patch for this into the release (cherry-picked to the release-v0.2 branch).

@aschmahmann
Copy link
Contributor

@fxfactorial thanks for the report. I think this issue is in go-libp2p-discovery, and I'll look into it. Could you post the options that you pass into pubsub during construction?

@fxfactorial
Copy link
Author

Goes through a higher level API via IPFS,

these might be relevant

ipfs_node.BuildCfg{
		Online:                      true,
		Permanent:                   true,
		DisableEncryptedConnections: false,
		NilRepo:                     false,
		Routing:                     routing,
		Host:                        hostopts,
		Repo:                        repo,
		ExtraOpts: map[string]bool{
			"pubsub":    true,
			"gossipsub": true,
		},
	}

and

	s, err := discovery.NewMdnsService(ctx, node.PeerHost, time.Second, "")

@vyzo
Copy link
Contributor

vyzo commented Apr 22, 2020

Yeah, this looks like an issue in go-libp2p-discovery.

@fxfactorial
Copy link
Author

Ah right - I initially wanted to write in discovery but tired eyes. Can ya’ll transfer the issue there

@aschmahmann aschmahmann transferred this issue from libp2p/go-libp2p-pubsub Apr 22, 2020
@aschmahmann
Copy link
Contributor

Closed by the PR above

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants