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 issue: Protect core.memorystore.pools #263

Closed
Sriep opened this issue May 11, 2021 · 0 comments · Fixed by #316
Closed

Race issue: Protect core.memorystore.pools #263

Sriep opened this issue May 11, 2021 · 0 comments · Fixed by #316
Assignees
Labels

Comments

@Sriep
Copy link
Contributor

Sriep commented May 11, 2021

Package wide global map pools needs protection.

Race error detected in PR #258 code/go/0chain.net/core/memorystore/connection_test.go

TestAddPool
==================
WARNING: DATA RACE
Write at 0x00c0001c4660 by goroutine 62:
  runtime.mapassign_faststr()
      /usr/local/go/src/runtime/map_faststr.go:202 +0x0
  0chain.net/core/memorystore.AddPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection.go:71 +0x168
  0chain.net/core/memorystore.TestAddPool.func3()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:233 +0x68
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202

Previous write at 0x00c0001c4660 by goroutine 63:
  runtime.mapassign_faststr()
      /usr/local/go/src/runtime/map_faststr.go:202 +0x0
  0chain.net/core/memorystore.AddPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection.go:71 +0x168
  0chain.net/core/memorystore.TestAddPool.func3()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:233 +0x68
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202

Goroutine 62 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1239 +0x5d7
  0chain.net/core/memorystore.TestAddPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:231 +0x294
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202

Goroutine 63 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1239 +0x5d7
  0chain.net/core/memorystore.TestAddPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:231 +0x294
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202
==================
==================
WARNING: DATA RACE
Write at 0x00c000323dc8 by goroutine 62:
  0chain.net/core/memorystore.AddPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection.go:71 +0x17d
  0chain.net/core/memorystore.TestAddPool.func3()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:233 +0x68
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202

Previous write at 0x00c000323dc8 by goroutine 63:
  0chain.net/core/memorystore.AddPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection.go:71 +0x17d
  0chain.net/core/memorystore.TestAddPool.func3()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:233 +0x68
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202

Goroutine 62 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1239 +0x5d7
  0chain.net/core/memorystore.TestAddPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:231 +0x294
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202

Goroutine 63 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1239 +0x5d7
  0chain.net/core/memorystore.TestAddPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:231 +0x294
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202
==================
    testing.go:1093: race detected during execution of test
--- FAIL: TestAddPool (0.00s)
    --- PASS: TestAddPool/Test_AddPool_OK#01 (0.00s)
    --- FAIL: TestAddPool/Test_AddPool_OK (0.00s)
TestInitDefaultPool
==================
WARNING: DATA RACE
Write at 0x000001082f90 by goroutine 130:
  0chain.net/core/memorystore.InitDefaultPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection.go:57 +0x84
  0chain.net/core/memorystore.TestInitDefaultPool.func1()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:877 +0x45
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202

=== RUN   Test_getConnectionCtxKey/#01
Previous write at 0x000001082f90 by goroutine 135:
  0chain.net/core/memorystore.InitDefaultPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection.go:57 +0x84
  0chain.net/core/memorystore.TestInitDefaultPool.func1()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:877 +0x45
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202

Goroutine 130 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1239 +0x5d7
  0chain.net/core/memorystore.TestInitDefaultPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:874 +0x1c4
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202

Goroutine 135 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1239 +0x5d7
  0chain.net/core/memorystore.TestInitDefaultPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:874 +0x1c4
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202
==================
==================
WARNING: DATA RACE
Write at 0x00c000323de0 by goroutine 130:
  0chain.net/core/memorystore.InitDefaultPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection.go:58 +0x1b3
  0chain.net/core/memorystore.TestInitDefaultPool.func1()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:877 +0x45
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202

Previous write at 0x00c000323de0 by goroutine 135:
  0chain.net/core/memorystore.InitDefaultPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection.go:58 +0x1b3
  0chain.net/core/memorystore.TestInitDefaultPool.func1()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:877 +0x45
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202

Goroutine 130 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1239 +0x5d7
  0chain.net/core/memorystore.TestInitDefaultPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:874 +0x1c4
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202

Goroutine 135 (finished) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1239 +0x5d7
  0chain.net/core/memorystore.TestInitDefaultPool()
      /home/piers/GolandProjects/0chain/code/go/0chain.net/core/memorystore/connection_test.go:874 +0x1c4
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202
==================
=== PAUSE Test_getConnectionCtxKey/#01
=== CONT  TestInitDefaultPool/Test_InitDefaultPool_OK#01
    testing.go:1093: race detected during execution of test
=== CONT  Test_getConnectionCtxKey
    testing.go:1093: race detected during execution of test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants