Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race in dial queue #311

Closed
anacrolix opened this issue Mar 27, 2019 · 0 comments · Fixed by #312
Closed

Race in dial queue #311

anacrolix opened this issue Mar 27, 2019 · 0 comments · Fixed by #312
Assignees

Comments

@anacrolix
Copy link
Contributor

==================
WARNING: DATA RACE
Read at 0x00c0007c1ae8 by goroutine 141:
  github.com/libp2p/go-libp2p-kad-dht.(*dialQueue).shrink()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/dial_queue.go:269 +0x47
  github.com/libp2p/go-libp2p-kad-dht.(*dialQueue).control()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/dial_queue.go:199 +0xe66

Previous write at 0x00c0007c1ae8 by goroutine 630:
  github.com/libp2p/go-libp2p-kad-dht.(*dialQueue).Start.func1()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/dial_queue.go:124 +0xc6
  sync.(*Once).Do()
      /Users/anacrolix/src/go1.12/src/sync/once.go:44 +0xde
  github.com/libp2p/go-libp2p-kad-dht.(*dialQueue).Start()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/dial_queue.go:119 +0x61
  github.com/libp2p/go-libp2p-kad-dht.(*dhtQueryRunner).Run()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/query.go:140 +0x247
  github.com/libp2p/go-libp2p-kad-dht.(*dhtQuery).Run()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/query.go:68 +0x10c
  github.com/libp2p/go-libp2p-kad-dht.(*IpfsDHT).GetClosestPeers.func2()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/lookup.go:96 +0xeb

Goroutine 141 (running) created at:
  github.com/libp2p/go-libp2p-kad-dht.newDialQueue()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/dial_queue.go:113 +0x38f
  github.com/libp2p/go-libp2p-kad-dht.newQueryRunner()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/query.go:104 +0x7cc
  github.com/libp2p/go-libp2p-kad-dht.(*dhtQuery).Run()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/query.go:67 +0xc9
  github.com/libp2p/go-libp2p-kad-dht.(*IpfsDHT).GetClosestPeers.func2()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/lookup.go:96 +0xeb

Goroutine 630 (running) created at:
  github.com/libp2p/go-libp2p-kad-dht.(*IpfsDHT).GetClosestPeers()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/lookup.go:92 +0x50d
  github.com/libp2p/go-libp2p-kad-dht.(*IpfsDHT).Provide()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-kad-dht/routing.go:413 +0x350
  github.com/ipfs/go-ipfs/exchange/reprovide.(*Reprovider).Reprovide.func1()
      /Users/anacrolix/go/src/github.com/ipfs/go-ipfs/exchange/reprovide/reprovide.go:93 +0xfa
  github.com/cenkalti/backoff.RetryNotify()
      /Users/anacrolix/go/pkg/mod/github.com/cenkalti/[email protected]+incompatible/retry.go:37 +0xc9
  github.com/ipfs/go-ipfs/exchange/reprovide.(*Reprovider).Reprovide()
      /Users/anacrolix/go/pkg/mod/github.com/cenkalti/[email protected]+incompatible/retry.go:24 +0x433
  github.com/ipfs/go-ipfs/exchange/reprovide.(*Reprovider).Run()
      /Users/anacrolix/go/src/github.com/ipfs/go-ipfs/exchange/reprovide/reprovide.go:65 +0x281
==================
Stebalien added a commit that referenced this issue Mar 27, 2019
Don't start the control loop till we start the queue. The _in_ queue will still
work, we just won't start processing peers from it until we start the control loop.

fixes #311
@ghost ghost assigned Stebalien Mar 27, 2019
@ghost ghost added the status/in-progress In progress label Mar 27, 2019
@ghost ghost removed the status/in-progress In progress label Mar 27, 2019
aarshkshah1992 pushed a commit to aarshkshah1992/go-libp2p-kad-dht that referenced this issue Aug 11, 2019
Don't start the control loop till we start the queue. The _in_ queue will still
work, we just won't start processing peers from it until we start the control loop.

fixes libp2p#311
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants