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: go1.8 release binaries for linux_amd64 error when building test dependencies with race mode enabled. #19133

Closed
warpfork opened this issue Feb 17, 2017 · 5 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@warpfork
Copy link

In the 1.8 binary releases for linux, go test -i -race tries to re-build some packages from the standard library. If your go install is not writable, it will error trying to open the $pkg.a files for writing.

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

Today's release: go version go1.8 linux/amd64
Specifically, the binary release from: https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
Sha384sum: 5cf34c2335341febb707008ede937729c5cf09f66c98e11065ecc58f945fc7d95e1ed10c1d8de765591de5cf20c16457 go1.8.linux-amd64.tar.gz

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

linux_amd64

What did you do?

Given a reproducer_test.go file:

package main

import "testing"

func Test(t *testing.T) {
	_ = 1
}

I run `go test in several different modes:

  • go test ./... -- passes
  • go test -race ./... -- passes
  • go test -i ./... -- passes
  • go test -i -race ./... -- FAILS

Go was installed by untar'ing the binary release. All of its uids are 0; all of its mtimes are as given by the tar headers.
The tarball is extracted in /installpath, and export GOROOT=/installpath/go applied to the environment.
(Identical steps have been used to install a go1.7 binary release, which does not exhibit the problem.)

What did you expect to see?

All four of these test commands should pass. (All four commands work correctly on go1.7.)

What did you see instead?

Test with -i and -race-mode gives the following error output:

go install internal/race: open /installpath/go/pkg/linux_amd64_race/internal/race.a: permission denied
go install errors: open /installpath/go/pkg/linux_amd64_race/errors.a: permission denied
go install unicode/utf8: open /installpath/go/pkg/linux_amd64_race/unicode/utf8.a: permission denied
go install unicode: open /installpath/go/pkg/linux_amd64_race/unicode.a: permission denied
go install math: open /installpath/go/pkg/linux_amd64_race/math.a: permission denied

and exits with a 1.

Other notes

When encountering this on less minimal code, I've seen several other packages also listed as offenders, such as crypto/subtle for example. The five listed above are what comes up with the minimal reproducer -- these five packages are dependencies of the testing package.

I thought perhaps this might be an issue from timestamps on the .a files being older than the relevant source files (I've made a mistake with an rsync command before that fubar'd that, and paid silly increases in compile time until I noticed and fixed it), but that doesn't appear to be the case, so I'm not sure what's going on here.

@ALTree ALTree changed the title go1.8 release binaries for linux_amd64 error when building test dependencies with race mode enabled. cmd/go: go1.8 release binaries for linux_amd64 error when building test dependencies with race mode enabled. Feb 18, 2017
@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 18, 2017
@ALTree ALTree added this to the Go1.9 milestone Feb 18, 2017
@amenzhinsky
Copy link
Contributor

amenzhinsky commented Feb 20, 2017

I added some debugging output what information is used to compute buildIDs by the computeBuildID function.

Here's what I got for the errors package:

$ go install -race errors

file errors.go
dep runtime 51c69445d7efe3df820352baa6e4847b749c7037
dep runtime/internal/atomic 812fcbb3b315b02f834932ddf0d767f87b435f38
dep runtime/internal/sys 9cd53b64a63f6fbdb1d94744178e63dcd846ffbc
dep unsafe f9f879f0869e26eb4f48b13b985c465e319e98ca
$ go test -race -i .

file errors.go
dep runtime 51c69445d7efe3df820352baa6e4847b749c7037
dep runtime/cgo ccefa1650c1e717f94656472e31519e1a5164a6d
dep runtime/internal/atomic 812fcbb3b315b02f834932ddf0d767f87b435f38
dep runtime/internal/sys 9cd53b64a63f6fbdb1d94744178e63dcd846ffbc
dep runtime/race 7e0d0b64d9bf634ad3b87c3668ad5f17a27dddb6
dep sync/atomic 0f3c254882f4f232509cf79b199b7f4449b0f54a
dep unsafe f9f879f0869e26eb4f48b13b985c465e319e98ca

@amenzhinsky
Copy link
Contributor

amenzhinsky commented Feb 20, 2017

Seems like it's caused by the default value of -covermode when -race is set
https://github.com/golang/go/blob/release-branch.go1.8/src/cmd/go/testflag.go#L193

And it affects package dependencies list:
https://github.com/golang/go/blob/release-branch.go1.8/src/cmd/go/pkg.go#L960

@gopherbot
Copy link

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

@gopherbot
Copy link

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

tomwilkie added a commit to weaveworks/service that referenced this issue Mar 1, 2017
* Switch to gRPC for AuthFE -> Users RPCs

- Use common/server in users service
- Add gRPC service for Lookup* operations
- Upgrade to go1.8
- Refactor users client library so the HTTP client gives us the same interface as the gRPC one.
- Split auth caching out into so it can be used with web or gRPC client

* Vendor gRPC etc

* Temporarily disable race tests due to golang/go#19133

* Instansiate gRPC client.

* Add graceful shutdown to common.Server.

* Review feedback

* Update integration tests to go1.8

* Split the gRPC code out into separate package

* Fix lint & test

* Add gRPC server middleware to correctly propagate error codes

* Intercept gRPC errors in the client and tranlate them into something the middleware understands.

* Fix lint

* Make error propagation cleaner.

* Fix lint:
@gopherbot
Copy link

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

gopherbot pushed a commit that referenced this issue Apr 5, 2017
… 'go test -i -race'

Manual port of CL 37598 (submitted for Go 1.9) to Go 1.8.1.

Fixes #19133.
Fixes #19151.

Change-Id: I51707ea35068a393022f554b391ee2638dba16b5
Reviewed-on: https://go-review.googlesource.com/39617
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
@golang golang locked and limited conversation to collaborators Apr 5, 2018
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

5 participants