]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/cache: handle cacheprog not responding to close
authorMichael Matloob <matloob@golang.org>
Mon, 6 Jan 2025 21:02:38 +0000 (16:02 -0500)
committerMichael Matloob <matloob@golang.org>
Tue, 7 Jan 2025 18:21:05 +0000 (10:21 -0800)
commitd93b549f0502ad9f44b7eacc282c304b22d2603b
tree29b1d1c4adcea3c551b49bae75090cb7fe8b9d08
parentd62154db837fef880714f710bafbe0af94034b40
cmd/go/internal/cache: handle cacheprog not responding to close

Allow a gocacheprog to not respond to close. The intention of the code
is that after we send the close message we'd ignore errors reading from
the cacheprog's stdout. But before this change if a cacheprog
did not respond to close and we got an EOF reading from the cacheprog's
stdout we'd just ignore all pending requests. The send operation would
then block forever waiting for a response. With this change, we close
all response channels for pending responses if there's an error reading
from the cacheprog's stdout while we're closing. The receives from the
response channels would then proceed (but now have to handle a nil
value). Then the send operation would return and the (*ProgCache).Close
function can proceed.

Fixes #70848

Change-Id: I6631d317ba7aea3f25f714f31cd2aeef0f4d4e3e
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/640516
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/go/internal/cache/prog.go
src/cmd/go/testdata/script/build_cacheprog_issue70848.txt [new file with mode: 0644]