Skip to content

testing: Data race on t.ran #20339

@jrick

Description

@jrick

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.8.1

What operating system and processor architecture are you using (go env)?

Linux amd64 (Travis CI runner)

What did you do?

One of our tests runs (*testing.T).Run concurrently and occasionally a data race is caused by unsafe access to the t.common.ran member.

WARNING: DATA RACE
Write at 0x00c420069081 by goroutine 21:
  testing.(*common).setRan()
      /home/travis/.gimme/versions/go1.8.1.linux.amd64/src/testing/testing.go:433 +0x97
  testing.(*common).setRan()
      /home/travis/.gimme/versions/go1.8.1.linux.amd64/src/testing/testing.go:429 +0xea
  testing.(*common).setRan()
      /home/travis/.gimme/versions/go1.8.1.linux.amd64/src/testing/testing.go:429 +0xea
  testing.tRunner.func1()
      /home/travis/.gimme/versions/go1.8.1.linux.amd64/src/testing/testing.go:650 +0x48c
  testing.tRunner()
      /home/travis/.gimme/versions/go1.8.1.linux.amd64/src/testing/testing.go:659 +0x123

Previous read at 0x00c420069081 by main goroutine:
  testing.runTests()
      /home/travis/.gimme/versions/go1.8.1.linux.amd64/src/testing/testing.go:890 +0x538
  testing.(*M).Run()
      /home/travis/.gimme/versions/go1.8.1.linux.amd64/src/testing/testing.go:822 +0x1c3
  main.main()
      github.com/decred/dcrwallet/wallet/udb/_test/_testmain.go:50 +0x20f

Goroutine 21 (running) created at:
  testing.(*T).Run()
      /home/travis/.gimme/versions/go1.8.1.linux.amd64/src/testing/testing.go:697 +0x543
  github.com/decred/dcrwallet/wallet/udb.TestUpgrades.func1()
      /home/travis/gopath/src/github.com/decred/dcrwallet/wallet/udb/upgrades_test.go:81 +0x17d

On testing.go:433 t.common.ran is protected by the t.common.mu mutex, but no mutex is grabbed during the read on testing.go:890.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions