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 build mixing tags when running builds in parallel #23315

Closed
xudongzheng opened this issue Jan 3, 2018 · 3 comments
Closed

cmd/go: go build mixing tags when running builds in parallel #23315

xudongzheng opened this issue Jan 3, 2018 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@xudongzheng
Copy link
Contributor

xudongzheng commented Jan 3, 2018

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

1.9.2

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

I've been able to reproduce this on both my Mac and Linux.

What did you do?

  • Package alfa (always built with tag alfa) uses package charlie.
  • Package bravo (always built with tag bravo) uses package charlie.
  • Package charlie behaves differently depending on the build tag (either alfa or bravo)

What did you see instead?

When I run two "go build" processes in parallel, sometimes alfa (with alfa tag) will include charlie (with bravo tag). The opposite also happens: bravo (with bravo tag) with charlie (with alfa tag). I've constructed a minimal example to demonstrate this: https://github.com/xudongzheng/alfabravo. If you run loop.sh, it will build with parallel.sh 100 times.

Here it doesn't happen consistently but when building for a personal project, it happens on every other build (presumably because the package is larger, the build takes longer, and there is more time for the race to occur).

screen shot 2018-01-02 at 22 07 37

@ianlancetaylor ianlancetaylor changed the title go build mixing tags when running builds in parallel cmd/go: go build mixing tags when running builds in parallel Jan 3, 2018
@bradfitz
Copy link
Contributor

bradfitz commented Jan 3, 2018

This is fixed in Go 1.10. See https://tip.golang.org/doc/go1.10#build

Let us know if you still have a problem.

@bradfitz bradfitz closed this as completed Jan 3, 2018
@xudongzheng
Copy link
Contributor Author

xudongzheng commented Jan 3, 2018

I'm able to reproduce the issue at tip, although with a slightly modified charlie package (I've updated my repository). The previous one was compiling too quickly so I added a .c file and the issue continues to occur. It may be difficult to reproduce the issue depending on how fast/slow your computer is.

screen shot 2018-01-03 at 00 29 15

@bradfitz
Copy link
Contributor

bradfitz commented Jan 3, 2018

I haven't looked at your updated repro, but I'll reopen this.

@bradfitz bradfitz reopened this Jan 3, 2018
@bradfitz bradfitz added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 3, 2018
@bradfitz bradfitz added this to the Go1.11 milestone Jan 3, 2018
@golang golang locked and limited conversation to collaborators Feb 21, 2019
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.
Projects
None yet
Development

No branches or pull requests

3 participants