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

runtime/race: TestRaceRange is not always detected as a race #10589

Closed
rsc opened this issue Apr 27, 2015 · 5 comments
Closed

runtime/race: TestRaceRange is not always detected as a race #10589

rsc opened this issue Apr 27, 2015 · 5 comments
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Apr 27, 2015

It seems to me that TestRaceRange should always be detected as a race. The code is:

func TestRaceRange(t *testing.T) {
    const N = 2
    var a [N]int
    var x, y int
    done := make(chan bool, N)
    for i, v := range a {
        go func(i int) {
            // we don't want a write-vs-write race
            // so there is no array b here
            if i == 0 {
                x = v
            } else {
                y = v
            }
            done <- true
        }(i)
    }
    for i := 0; i < N; i++ {
        <-done
    }
}

The actual execution is

v = a[0]
go func() { x = v }()
v = a[1]
go func() { y = v }()

and the race is between the x = v and the v = a[1].

When Austin tweaked the goroutine scheduler behavior, the race detector stopped detecting this race. Adding a Gosched brought the detection of the race back, but it seems like it should be detected even without a Gosched.

@aclements

@rsc rsc added this to the Go1.5 milestone Apr 27, 2015
@dvyukov
Copy link
Member

dvyukov commented Apr 28, 2015

This is a bug in race runtime. Fixed upstream:
http://llvm.org/viewvc/llvm-project?view=revision&revision=236008
Need to update race runtime, which is difficult until #8653 is resolved.

@aclements
Copy link
Member

@dvyukov, it looks like #8653 is unresolved and has milestone Unreleased. Should we bump this issue to Unreleased?

@rsc rsc modified the milestones: Unplanned, Go1.5 Jul 15, 2015
@dvyukov dvyukov modified the milestones: Go1.6, Unplanned Jul 19, 2015
@rsc
Copy link
Contributor Author

rsc commented Nov 5, 2015

It would be nice to bring in a new copy of the race runtime for Go 1.6, whether or not #8653 is fixed.

@dvyukov
Copy link
Member

dvyukov commented Nov 5, 2015

We need to resolve #8653. The project will benefit is not only me can rebuild the runtime. And even for me it is painful currently. I don't access to any windows nor darwin machines after the move.
Do we have all 4 OSes in the new infrastructure?
@bradfitz can you help me with this? I can work out the scripts, but there were issues like something is missing on the machines, or unclear how to do something.

@bradfitz
Copy link
Contributor

I can answer concrete questions about the build system & gomote, but not "why doesn't the race detector build with gomote?".

@golang golang locked and limited conversation to collaborators Nov 16, 2016
@rsc rsc unassigned dvyukov Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants