cmd/go: concurrent build and cache clean is unsafe #31948
Labels
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Migrated from discussion in #31931.
If you start a build with
go build
, and rungo cache -clean
while it is building, the build can fail, because intermediate artifacts get deleted.A sample failure looks like:
@jayconrod wrote:
@bcmills wrote:
I am not sure that @jayconrod's second option would work: I believe the problem is that the clean deletes files previously created by this build, which the build is still relying on.
@jayconrod's first option would work as long as
go clean -cache
is also blocked untilgo build
is done. This makes it look a lot like a RW lock, as @bcmills notes. The only remaining danger is starvation of the clean. (That could actually happen in my particular, unusual case, since I am running many concurrent builds, but that's probably not worth designing around.)The text was updated successfully, but these errors were encountered: