Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Race condition in tests #40

Closed
anacrolix opened this issue Mar 26, 2019 · 0 comments · Fixed by #50
Closed

Race condition in tests #40

anacrolix opened this issue Mar 26, 2019 · 0 comments · Fixed by #50

Comments

@anacrolix
Copy link
Contributor

==================
WARNING: DATA RACE
Write at 0x000001bd92a0 by goroutine 67:
  github.com/libp2p/go-libp2p-secio.TestConnections()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/transport_test.go:253 +0x1ef
  testing.tRunner()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:827 +0x162

Previous read at 0x000001bd92a0 by goroutine 42:
  github.com/libp2p/go-libp2p-secio.(*secureSession).runHandshakeSync()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/protocol.go:158 +0x27a
  github.com/libp2p/go-libp2p-secio.(*secureSession).runHandshake.func1()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/protocol.go:123 +0x38

Goroutine 67 (running) created at:
  testing.(*T).Run()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:878 +0x659
  testing.runTests.func1()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:1119 +0xa8
  testing.tRunner()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:827 +0x162
  testing.runTests()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:1117 +0x4ee
  testing.(*M).Run()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:1034 +0x2ee
  main.main()
      _testmain.go:48 +0x221

Goroutine 42 (finished) created at:
  github.com/libp2p/go-libp2p-secio.(*secureSession).runHandshake()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/protocol.go:121 +0x17a
  github.com/libp2p/go-libp2p-secio.newSecureSession()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/protocol.go:96 +0x834
  github.com/libp2p/go-libp2p-secio.(*Transport).SecureInbound()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/transport.go:37 +0xec
  github.com/libp2p/go-conn-security/test.SubtestCancelHandshakeInbound.func1()
      /Users/anacrolix/go/pkg/mod/github.com/libp2p/[email protected]/test/ttest.go:311 +0xa0
==================
==================
WARNING: DATA RACE
Write at 0x000001bd9290 by goroutine 67:
  github.com/libp2p/go-libp2p-secio.TestConnections()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/transport_test.go:254 +0x23b
  testing.tRunner()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:827 +0x162

Previous read at 0x000001bd9290 by goroutine 42:
  github.com/libp2p/go-libp2p-secio.(*secureSession).runHandshakeSync()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/protocol.go:159 +0x2f2
  github.com/libp2p/go-libp2p-secio.(*secureSession).runHandshake.func1()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/protocol.go:123 +0x38

Goroutine 67 (running) created at:
  testing.(*T).Run()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:878 +0x659
  testing.runTests.func1()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:1119 +0xa8
  testing.tRunner()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:827 +0x162
  testing.runTests()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:1117 +0x4ee
  testing.(*M).Run()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:1034 +0x2ee
  main.main()
      _testmain.go:48 +0x221

Goroutine 42 (finished) created at:
  github.com/libp2p/go-libp2p-secio.(*secureSession).runHandshake()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/protocol.go:121 +0x17a
  github.com/libp2p/go-libp2p-secio.newSecureSession()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/protocol.go:96 +0x834
  github.com/libp2p/go-libp2p-secio.(*Transport).SecureInbound()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/transport.go:37 +0xec
  github.com/libp2p/go-conn-security/test.SubtestCancelHandshakeInbound.func1()
      /Users/anacrolix/go/pkg/mod/github.com/libp2p/[email protected]/test/ttest.go:311 +0xa0
==================
==================
WARNING: DATA RACE
Write at 0x000001bd92b0 by goroutine 67:
  github.com/libp2p/go-libp2p-secio.TestConnections()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/transport_test.go:255 +0x28a
  testing.tRunner()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:827 +0x162

Previous read at 0x000001bd92b0 by goroutine 38:
  github.com/libp2p/go-libp2p-secio.(*secureSession).runHandshakeSync()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/protocol.go:160 +0x36a
  github.com/libp2p/go-libp2p-secio.(*secureSession).runHandshake.func1()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/protocol.go:123 +0x38

Goroutine 67 (running) created at:
  testing.(*T).Run()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:878 +0x659
  testing.runTests.func1()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:1119 +0xa8
  testing.tRunner()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:827 +0x162
  testing.runTests()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:1117 +0x4ee
  testing.(*M).Run()
      /Users/anacrolix/src/go1.11/src/testing/testing.go:1034 +0x2ee
  main.main()
      _testmain.go:48 +0x221

Goroutine 38 (finished) created at:
  github.com/libp2p/go-libp2p-secio.(*secureSession).runHandshake()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/protocol.go:121 +0x17a
  github.com/libp2p/go-libp2p-secio.newSecureSession()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/protocol.go:96 +0x834
  github.com/libp2p/go-libp2p-secio.(*Transport).SecureOutbound()
      /Users/anacrolix/go/src/github.com/libp2p/go-libp2p-secio/transport.go:40 +0xfe
  github.com/libp2p/go-conn-security/test.SubtestCancelHandshakeInbound.func2()
      /Users/anacrolix/go/pkg/mod/github.com/libp2p/[email protected]/test/ttest.go:321 +0xc0
==================
--- FAIL: TestConnections (0.23s)
    transport_test.go:247: Using default session parameters.
    transport_test.go:257: Using Exchange: P-384 Cipher: Blowfish Hash: SHA256
    transport_test.go:257: Using Exchange: P-256 Cipher: AES-128 Hash: SHA512
    transport_test.go:257: Using Exchange: P-521 Cipher: AES-256 Hash: SHA256
    testing.go:771: race detected during execution of test
FAIL
FAIL	github.com/libp2p/go-libp2p-secio	7.454s
Stebalien added a commit that referenced this issue Jun 15, 2019
That makes sure we aren't still writing/reading after we relinquish control.

fixes #40

may be related to ipfs/kubo#6197?
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant