-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: document if the go test and build cache is threadsafe #40461
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
I don’t think it is |
I know for sure that cleaning the build cache ( |
Okay but what about multiple parallel |
This is safe on most file systems. Files are added to the cache atomically, and a global file lock is held when files are evicted. If the file system does not support file locking or atomic renaming, then it may not be safe. |
FWIW, the build and test cache does not use file locking, and I don't think it relies on atomic renaming either. (Instead, it writes the expected lengths in metadata files, and overwrites and appends to partial files in-place rather than truncating or deleting them.) |
I take that back: we use file-locking in one place in the test cache, to store the expiration date for stale tests. go/src/cmd/go/internal/test/test.go Lines 609 to 613 in 6a167c7
|
@alvaroaleman are you hoping to do simultaneous |
@networkimprov the question came up in the context of "We prepopulate and then use one cache per machine that runs many concurrent builds" |
If prepopulated, is your cache read-only? |
Its not my cache and I believe its not |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Duplicate of #26677 |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go help cache
What did you expect to see?
A sentence telling me if the go build and test cache is safe for parallel use by multiple invocation of the
go
binaryWhat did you see instead?
The text was updated successfully, but these errors were encountered: