cmd/go: GOCACHEPROG asks to overwrite existing output ID with open file #71059
Labels
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
release-blocker
Milestone
Go version
go version go1.24rc1 windows/amd64
Output of
go env
in your module/workspace:Also
set GOCACHEPROG=go-cacher --verbose
(seems to be missing from go.env)What did you do?
λ go build -v .
with above cache enabled.What did you see happen?
It seems like the go builder keeps the output file open in some cases while asking the cache to update it... This is a problem on Windows, since it is unable to write to an open file.
Request 1, asks for an output id
{"ID":1,"Command":"get","ActionID":"pBAlwHUzJSDNnEKHSTg/axJSDSKXGl8g+SZj8jK6m58="}
We respond with the output id:
{"ID":1,"OutputID":"/Rw93YonOb5fieSCtjYgTXP1E/KTrUN78aVuoX9f++A=","Size":283,"Time":"2024-12-29T15:19:59.2800213+01:00","DiskPath":"C:\\Users\\klaus\\AppData\\Local\\go-cacher\\o-fd1c3ddd8a2739be5f89e482b636204d73f513f293ad437bf1a56ea17f5ffbe0"}
go
file then opens this file (grabbed through process monitor)It then sends a request to update the same output id:
With deterministic files, this fails since
go.exe
never closed the handle on the file:We return an error:
{"ID":2,"Err":"rename C:\\Users\\klaus\\AppData\\Local\\go-cacher\\o-fd1c3ddd8a2739be5f89e482b636204d73f513f293ad437bf1a56ea17f5ffbe0.3796057084 C:\\Users\\klaus\\AppData\\Local\\go-cacher\\o-fd1c3ddd8a2739be5f89e482b636204d73f513f293ad437bf1a56ea17f5ffbe0: Access is denied."}
... and
go.exe
now closes the file:It seems to only happen on non-clean setup. Building from scratch doesn't trigger the issue.
What did you expect to see?
Go closes the file before it asks cache to update it.
The text was updated successfully, but these errors were encountered: