aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authormatloob <matloob@golang.org>2026-03-12 12:58:19 -0400
committerMichael Matloob <matloob@golang.org>2026-03-13 09:21:57 -0700
commit5b152b0ba77a66d7b122e1ab89275e2bca85730b (patch)
tree88260cb8b98f31894c0b71598eb67499e34e3100 /src/cmd
parent9ce4f3876e89a43dbd8508cb2762a2e4644dfe84 (diff)
downloadgo-5b152b0ba77a66d7b122e1ab89275e2bca85730b.tar.xz
cmd/go/internal/vcweb: hold hg server lock while serving
vcweb does not like multiple tests trying to access the hg server concurrently. Hold a lock while proxying the request to the hg server to serialize access. This is needed to enable us to split our tests using hg repos into multiple test cases so that they can run concurrently. For #78152 Change-Id: I4fb997f2be8cf8797f70adab1694be916a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/754760 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Michael Matloob <matloob@google.com> Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/go/internal/vcweb/hg.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/go/internal/vcweb/hg.go b/src/cmd/go/internal/vcweb/hg.go
index fb77d1a2fc..c94a22524f 100644
--- a/src/cmd/go/internal/vcweb/hg.go
+++ b/src/cmd/go/internal/vcweb/hg.go
@@ -92,9 +92,9 @@ func (h *hgHandler) Handler(dir string, env []string, logger *log.Logger) (http.
// repos we serve, so leaving a dozen processes around is not a big deal.
u := h.url[dir]
if u != nil {
- h.mu.Unlock()
logger.Printf("proxying hg request to %s", u)
httputil.NewSingleHostReverseProxy(u).ServeHTTP(w, req)
+ h.mu.Unlock()
return
}
@@ -168,7 +168,7 @@ func (h *hgHandler) Handler(dir string, env []string, logger *log.Logger) (http.
}
h.url[dir] = u
h.cmds = append(h.cmds, cmd)
- h.mu.Unlock()
+ defer h.mu.Unlock()
logger.Printf("proxying hg request to %s", u)
httputil.NewSingleHostReverseProxy(u).ServeHTTP(w, req)