Skip to content

context: Always call returned cancel funcs #878

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

Merged
merged 4 commits into from
Mar 7, 2015
Merged

Conversation

cryptix
Copy link
Contributor

@cryptix cryptix commented Mar 7, 2015

This PR follows up on #822.

@cryptix
Copy link
Contributor Author

cryptix commented Mar 7, 2015

I guess 3e6effc cancels in the wrong place.

==================
WARNING: DATA RACE
Write by goroutine 149:
  sync.raceWrite()
      /usr/local/go/src/pkg/sync/race.go:41 +0x35
  sync.(*WaitGroup).Wait()
      /usr/local/go/src/pkg/sync/waitgroup.go:122 +0x176
  github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup.(*contextGroup).closeLogic()
      /workspace/race/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup/ctxgroup.go:202 +0xba
  github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup.*contextGroup.(github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup.closeLogic)��fm()
      /workspace/race/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup/ctxgroup.go:192 +0x33
  sync.(*Once).Do()
      /usr/local/go/src/pkg/sync/once.go:40 +0xb1

Previous read by goroutine 121:
  sync.raceRead()
      /usr/local/go/src/pkg/sync/race.go:37 +0x35
  sync.(*WaitGroup).Add()
      /usr/local/go/src/pkg/sync/waitgroup.go:60 +0xbe
  github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup.(*contextGroup).AddChildFunc()
      /workspace/race/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup/ctxgroup.go:168 +0x4d
  github.com/jbenet/go-ipfs/routing/dht.(*dhtQueryRunner).Run()
      /workspace/race/src/github.com/jbenet/go-ipfs/routing/dht/query.go:110 +0x45d
  github.com/jbenet/go-ipfs/routing/dht.(*dhtQuery).Run()
      /workspace/race/src/github.com/jbenet/go-ipfs/routing/dht/query.go:59 +0xe1
  github.com/jbenet/go-ipfs/routing/dht.func��009()
      /workspace/race/src/github.com/jbenet/go-ipfs/routing/dht/lookup.go:83 +0x119

Goroutine 149 (running) created at:
  github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup.(*contextGroup).internalClose()
      /workspace/race/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup/ctxgroup.go:192 +0x92
  github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup.(*contextGroup).closeOnContextDone()
      /workspace/race/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-ctxgroup/ctxgroup.go:211 +0xa9

Goroutine 121 (running) created at:
  github.com/jbenet/go-ipfs/routing/dht.(*IpfsDHT).GetClosestPeers()
      /workspace/race/src/github.com/jbenet/go-ipfs/routing/dht/lookup.go:87 +0xa24
  github.com/jbenet/go-ipfs/routing/dht.(*IpfsDHT).Provide()
      /workspace/race/src/github.com/jbenet/go-ipfs/routing/dht/routing.go:151 +0x342
  github.com/jbenet/go-ipfs/exchange/bitswap/network.(*impl).Provide()
      /workspace/race/src/github.com/jbenet/go-ipfs/exchange/bitswap/network/ipfs_impl.go:138 +0xa8
  github.com/jbenet/go-ipfs/exchange/bitswap.(*Bitswap).provideWorker()
      /workspace/race/src/github.com/jbenet/go-ipfs/exchange/bitswap/workers.go:72 +0x2c8
  github.com/jbenet/go-ipfs/exchange/bitswap.func��013()
      /workspace/race/src/github.com/jbenet/go-ipfs/exchange/bitswap/workers.go:37 +0x6e
  github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess.func��005()
      /workspace/race/src/github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess/impl-mutex.go:96 +0xa8
==================
2015-03-07 11:01:13.291539 ERROR bitswap <autogenerated>:24: context canceled
2015-03-07 11:01:13.292278 ERROR bitswap <autogenerated>:24: context canceled
2015-03-07 11:02:58.251986 CRITICAL boguskey <autogenerated>:21: TestBogusPrivateKey.Sign -- this better be a test!
PASS
Found 1 data race(s)
FAIL    github.com/jbenet/go-ipfs/test/integration  288.244s

src

@jbenet
Copy link
Member

jbenet commented Mar 7, 2015

@cryptix yeah im doing it the hard way (proc)

@cryptix
Copy link
Contributor Author

cryptix commented Mar 7, 2015

still faults with same race. Need some insight here - maybe FindProvidersAsync() has to cancel - cc @whyrusleeping

@jbenet
Copy link
Member

jbenet commented Mar 7, 2015

@cryptix oh!! thats the race im fixing in #877 -- i thought you had rebase on top of mine. im about to push a fix

@cryptix
Copy link
Contributor Author

cryptix commented Mar 7, 2015

not sure - i rebased on master, is it in there?

@jbenet
Copy link
Member

jbenet commented Mar 7, 2015

@cryptix no not yet-- a few min. its in tests now, i think i got it this time around. want to CR it? #877

@jbenet
Copy link
Member

jbenet commented Mar 7, 2015

#877 landed-- you can rebase now

@cryptix cryptix force-pushed the dontIgnoreCancelFuncs branch from 35c0ac0 to a744f31 Compare March 7, 2015 12:26
@cryptix
Copy link
Contributor Author

cryptix commented Mar 7, 2015

@jbenet perfect, all green! 😄. not sure if i can move the cancel() back up before the <-done. waiting for @whyrusleeping

@jbenet
Copy link
Member

jbenet commented Mar 7, 2015

@cryptix this LGTM so far. also not sure about moving the cancel() before <-done.

@cryptix cryptix force-pushed the dontIgnoreCancelFuncs branch from a744f31 to aa55eeb Compare March 7, 2015 13:47
@cryptix
Copy link
Contributor Author

cryptix commented Mar 7, 2015

not sure about moving the cancel() before <-done.

I reseted to the commit before - race tests passed, looks like #877 fixed this one.

@jbenet
Copy link
Member

jbenet commented Mar 7, 2015

@cryptix yay :)

jbenet added a commit that referenced this pull request Mar 7, 2015
context: Always call returned cancel funcs
@jbenet jbenet merged commit bff7f73 into master Mar 7, 2015
@jbenet jbenet removed the status/in-progress In progress label Mar 7, 2015
@jbenet jbenet deleted the dontIgnoreCancelFuncs branch March 7, 2015 17:49
@jbenet
Copy link
Member

jbenet commented Mar 7, 2015

@cryptix @whyrusleeping though i merged-- pls CR!

@cryptix
Copy link
Contributor Author

cryptix commented Mar 7, 2015

LGTM

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 this pull request may close these issues.

3 participants