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

cmd/go: 'go test -race ...' misses race condition on go1.9.2 linux/amd64 #23276

Closed
markcampanelli-wf opened this issue Dec 28, 2017 · 8 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@markcampanelli-wf
Copy link

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

go1.9.2 darwin/amd64 and go1.9.2 linux/amd64

Does this issue reproduce with the latest release?

Yes, but only on go1.9.2 linux/amd64, not on go1.9.2 darwin/amd64.

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

darwin/amd64 and linux/amd64

What did you do?

Ran go test -race ... with a test that has repeatable race conditions.

What did you expect to see?

On go1.9.2 darwin/amd64, (i.e., local dev) the race condition appears between the RUN and FAIL lines, and the failure registers in go2xunit conversion to xUnit. I would expect the same on our CI test runner machine, which is go1.9.2 linux/amd64.

What did you see instead?

On go1.9.2 linux/amd64, the data race warnings appear after the RUN and PASS lines for the offending test, but before the next test's RUN line. Exit code is zero, indicated no race(s). Subsequently, go2xunit doesn't pick up any failure OR the WARNING: DATA RACE (even with -fail-on-race flag set).

=== RUN   TestMyRaceyTest
--- PASS: TestMyRaceyTest (1.01s)
==================
WARNING: DATA RACE
...
==================
WARNING: DATA RACE
...
==================
WARNING: DATA RACE
...
=== RUN TestOtherTest
...
@odeke-em
Copy link
Member

@markcampanelli-wf just as per Ocam's razor, did you turn on the -race flag for the Travis CI?
screen shot 2017-12-28 at 3 51 35 pm

I ask because as in the screenshot above doesn't seem y'all turned on the -race flag in https://github.com/tebeka/go2xunit/blob/7c4e1816919ef50bb9cd04b1166421e7abb7c5cd/.travis.yml#L1-L6

Could you help us clarify and perhaps link to a Travis build with the -race flag turned on? Thank you.

@markcampanelli-wf
Copy link
Author

markcampanelli-wf commented Dec 28, 2017

Yes sorry (from the Makefile):

go test -short -race -v -ldflags -s `go list ./...` | tee "$${ROOT:-/testing}/test_reports/go_test_results.out"
go2xunit -input "$${ROOT:-/testing}/test_reports/go_test_results.out" -output "$${ROOT:-/testing}/test_reports/go_test_results.xml"

Also, CI is homegrown in a docker container on an EC2 instance.

@davecheney
Copy link
Contributor

davecheney commented Dec 28, 2017 via email

@odeke-em odeke-em added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 31, 2017
@markcampanelli-wf
Copy link
Author

While including stderr is indeed wise, this didn't make a difference here.

@bcmills
Copy link
Contributor

bcmills commented Jan 2, 2018

Are you sure the race actually occurs while the test function is running?
A lot of races occur in leaked or “background” goroutines.

An example demonstrating the actual race in question would be helpful either way.

@markcampanelli-wf
Copy link
Author

That is possible, but it was a newly added test when issue started appearing. In any event, we just grep 'WARNING: DATA RACE' now on the captured output and fail on match.

@ianlancetaylor
Copy link
Contributor

I don't know what is going on here, and it does seem possible hat it could be related to the CI system in some way. In order to make progress we will need instructions on how to reproduce the problem ourselves. Thanks.

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 28, 2018
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Mar 28, 2018
@andybons
Copy link
Member

Been waiting for info for a while. Closing.

@andybons andybons changed the title 'go test -race ...' misses race condition on go1.9.2 linux/amd64 cmd/go: 'go test -race ...' misses race condition on go1.9.2 linux/amd64 May 14, 2019
@golang golang locked and limited conversation to collaborators May 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

7 participants