-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/dist, cmd/go: Go tip leaving pkg/mod/golang.org/x/telemetry read-only files behind #67463
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
Comments
Thanks for reporting. Some notes from when I briefly looked in case they're helpful. cmd/dist sets GOPATH env var (which in turn sets the module cache location) to $GOROOT/pkg/obj/gopath during the bootstrap with the following comment:
(source) The It's probably intended for |
I've been running 2f64268 for six hours today as I work and I haven't seen these files, or any other read-only files, being created yet. I'm not sure if this is a bug or issue that already got fixed in the last couple of days. |
This doesn't reproduce each time for me, but I saw it happen again today after running these commands in my development GOROOT directory today:
(I don't always do It might be relevant that I have opted in to telemetry uploading (i.e., my CC @golang/telemetry for awareness. |
Thanks for reporting. The telemetry upload, which may be initiated from a subprocess of the go command, runs |
Marking as a release blocker since I don't think we should cut the rc until we understand this. |
We get the config as part of the upload process. The telemetry upload code downloads the latest config to the modcache using go mod download and then examines the config to see what it's allowed to upload. @mvdan Talking to @rfindley, I understand that the reason you're not consistently observing this is that we only do the upload once a week, so we won't do the download of the config again until the next telemetry upload until a week has passed since the last telemetry upload. And if we understand what's going on correctly, you'd have to run make.bash when you're due for an upload or we'd just download the modules to the normal mod cache location. @rfindley Yes that definitely sounds possible. I think we should try to skip the upload if @dmitshur I think we definitely don't want to use a |
To close the loop here, @hyangah suggested that we use a temp GOMODCACHE for config download, and I think that makes sense. We already throttle the upload operation to once a day, and the config module is by design tiny, so the additional bandwidth of re-downloading the config should really not be a concern. (and we can do even better by only downloading the config when there is actually work to perform). If we have consensus among @golang/telemetry, I can do this on Monday. |
Using a temp GOMODCACHE will not solve the problem, because downloads will still write other files to the temporary GOPATH ($GOROOT/pkg/obj/gopath) such as the checksum database files. And we can't set a temporary GOPATH because then the checksum database lookups won't catch forking attacks. Probably cmd/dist should set GOPROXY=off to disable any downloads while its custom GOPATH is set. I don't believe the telemetry code should have special cases for GOPATH inside GOROOT or anything like that to try to detect running under cmd/dist. Instead, cmd/dist should just set things up the right way. |
I admit I'm not sure I follow the details of the discussion :) The read-only files are still not present as of today. The earlier suggestion that this might only trigger when an infrequent telemetry upload happens makes sense. I'm happy with any solution that prevents read-only files, or ideally any cache files, from being created inside GOROOT. |
@mvdan to summarize:
|
Ah gotcha, that makes sense. It's perhaps not surprising that I ran into this within a week of telemetry being added to cmd/go in master, because pretty much the first thing I do when I start my work day is to pull master and re-build :) In most cases I wouldn't have run any other Go command since the afternoon or evening prior. |
I'll send a CL to cmd/dist to turn GOPROXY=off in cmd/dist while GOPATH is set to be in GOROOT. |
Change https://go.dev/cl/586078 mentions this issue: |
In the past week or so, since @matloob started working on telemetry support in cmd/go, I've started having issues with my source builds from master where read-only module cache files are left behind inside GOROOT:
That was a build from d05af62. I just did a clean build of 2f64268 and the read-only files weren't created right away, but I'm not sure if they will be created at some point as I use cmd/go.
The text was updated successfully, but these errors were encountered: