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 -i runtime/race installs race-enabled cmd/cgo #10500

Closed
rsc opened this issue Apr 19, 2015 · 3 comments
Closed

cmd/go: go test -i runtime/race installs race-enabled cmd/cgo #10500

rsc opened this issue Apr 19, 2015 · 3 comments
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Apr 19, 2015

The runtime race tests during run.bash do:

if err := t.dirCmd(".", "go", "test", "-race", "-i", "runtime/race", "flag", "os/exec").Run(); err != nil {
    return err
}
if err := t.dirCmd(".", "go", "test", "-race", "-run=Output", "runtime/race").Run(); err != nil {
    return err
}
if err := t.dirCmd(".", "go", "test", "-race", "-short", "flag", "os/exec").Run(); err != nil {
    return err
}

At some point during this, most likely during "go test -race -i runtime/race flag os/exec", the installed cmd/cgo binary becomes a race-enabled cmd/cgo with tsan linked into it.

The most obvious effect of linking tsan is that cmd/cgo becomes unable to run in under 1 second. It looks like there is a 1-second sleep in the tsan finalizers (for a good reason I assume, but cc @dvyukov).

To be clear, the bug here is not the 1-second sleep but the fact that the go command is installing a race-enabled cgo.

@rsc rsc self-assigned this Apr 19, 2015
@rsc rsc added this to the Go1.5 milestone Apr 19, 2015
@minux
Copy link
Member

minux commented Apr 19, 2015 via email

@dvyukov
Copy link
Member

dvyukov commented Apr 20, 2015

Yes, atexit sleep is for a good reason. It can be disabled by setting GORACE=atexit_sleep_ms=0 env var.

I've added 'go test -race -i' to avoid rebuilding race packages several times during subsequent steps. There is no other motivation, so it can be removed.

Or we can explicitly reinstall non-race cmd/cgo afterwards (although, somewhat unreliable in the face of future changes).

@gopherbot
Copy link

CL https://golang.org/cl/12174 mentions this issue.

@rsc rsc closed this as completed in 6ab582a Jul 15, 2015
@golang golang locked and limited conversation to collaborators Jul 18, 2016
@rsc rsc removed their assignment 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

4 participants