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

fix(async): fix another data race in the async package #14114

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Jun 16, 2024

What type of PR is this?

Uncomment one line below and remove others.

Bug fix
Feature
Documentation
Other

What does this PR do? Why is it needed?

datarace when run go test ./async/... -v -race:

WARNING: DATA RACE
Write at 0x00c000c06010 by goroutine 188:
  runtime.closechan()
      /usr/local/go/src/runtime/chan.go:357 +0x0
  github.com/prysmaticlabs/prysm/v5/async.Scatter.deferwrap1()
      /root/code/prysm/async/scatter.go:30 +0x33
  runtime.deferreturn()
      /usr/local/go/src/runtime/panic.go:602 +0x5d
  github.com/prysmaticlabs/prysm/v5/async_test.TestError()
      /root/code/prysm/async/scatter_test.go:93 +0xb5
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /usr/local/go/src/testing/testing.go:1742 +0x44

Previous read at 0x00c000c06010 by goroutine 189:
  runtime.chansend()
      /usr/local/go/src/runtime/chan.go:160 +0x0
  github.com/prysmaticlabs/prysm/v5/async.Scatter.func1()
      /root/code/prysm/async/scatter.go:45 +0x12c
  github.com/prysmaticlabs/prysm/v5/async.Scatter.gowrap3()
      /root/code/prysm/async/scatter.go:50 +0x4f

Goroutine 188 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1742 +0x825
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:2161 +0x85
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1689 +0x21e
  testing.runTests()
      /usr/local/go/src/testing/testing.go:2159 +0x8be
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:2027 +0xf17
  main.main()
      _testmain.go:85 +0x2bd

Goroutine 189 (finished) created at:
  github.com/prysmaticlabs/prysm/v5/async.Scatter()
      /root/code/prysm/async/scatter.go:40 +0x3db
  github.com/prysmaticlabs/prysm/v5/async_test.TestError()
      /root/code/prysm/async/scatter_test.go:93 +0xb5
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /usr/local/go/src/testing/testing.go:1742 +0x44
==================
    testing.go:1398: race detected during execution of test
--- FAIL: TestError (0.00s)


WARNING: DATA RACE
Write at 0x00c000222870 by goroutine 82:
  runtime.mapassign_faststr()
      /usr/local/go/src/runtime/map_faststr.go:203 +0x0
  github.com/prysmaticlabs/prysm/v5/async.getChan()
      /root/code/prysm/async/multilock.go:120 +0x11e
  github.com/prysmaticlabs/prysm/v5/async.(*Lock).Lock()
      /root/code/prysm/async/multilock.go:43 +0x15d
  github.com/prysmaticlabs/prysm/v5/async.TestLockUnlock_DoesNotCleanIfHeldElsewhere.func2()
      /root/code/prysm/async/multilock_test.go:140 +0x104

Previous read at 0x00c000222870 by goroutine 81:
  github.com/prysmaticlabs/prysm/v5/async.TestLockUnlock_DoesNotCleanIfHeldElsewhere.func1()
      /root/code/prysm/async/multilock_test.go:135 +0xda

Goroutine 82 (running) created at:
  github.com/prysmaticlabs/prysm/v5/async.TestLockUnlock_DoesNotCleanIfHeldElsewhere()
      /root/code/prysm/async/multilock_test.go:138 +0x1bc
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /usr/local/go/src/testing/testing.go:1742 +0x44

Goroutine 81 (finished) created at:
  github.com/prysmaticlabs/prysm/v5/async.TestLockUnlock_DoesNotCleanIfHeldElsewhere()
      /root/code/prysm/async/multilock_test.go:128 +0x10c
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /usr/local/go/src/testing/testing.go:1742 +0x44

Fixes another data

Other notes for review

@jsvisa jsvisa requested a review from a team as a code owner June 16, 2024 09:05
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.

1 participant