Skip to content

cmd/go: go test intermittently hangs before test binary execution on windows/amd64 #81368

Open

Description

@heymaikol

Go version

go version go1.27.0 windows/amd64

Go 1.27.1 was also independently observed exhibiting the same hang (see "Go version A/B" below).

Output of go env in your module/workspace

set AR=ar
set CC=gcc
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_ENABLED=1
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set CXX=g++
set GCCGO=gccgo
set GO111MODULE=
set GOAMD64=v1
set GOARCH=amd64
set GOAUTH=netrc
set GOBIN=C:\Users\runneradmin\go\bin
set GOCACHE=C:\Users\runneradmin\AppData\Local\go-build
set GOCACHEPROG=
set GODEBUG=
set GOENV=C:\Users\runneradmin\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFIPS140=off
set GOFLAGS=
set GOGCCFLAGS=-m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\RUNNER~1\AppData\Local\Temp\go-build2098717326=/tmp/go-build -gno-record-gcc-switches
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMOD=D:\a\network-doctor\network-doctor\go.mod
set GOMODCACHE=C:\Users\runneradmin\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPACKAGESDRIVER=
set GOPATH=C:\Users\runneradmin\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\hostedtoolcache\windows\go\1.27.0\x64
set GOSUMDB=sum.golang.org
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\runneradmin\AppData\Roaming\go\telemetry
set GOTMPDIR=
set GOTOOLCHAIN=local
set GOTOOLDIR=C:\hostedtoolcache\windows\go\1.27.0\x64\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.27.0
set GOWORK=
set PKG_CONFIG=pkg-config

Captured on GitHub-hosted windows-2025-vs2026 (image version 20260824.214.3, runner version 2.337.0, Windows build 10.0.26100), GOTOOLCHAIN=local, from reproducing run: https://github.com/heymaikol/network-doctor/actions/runs/33948156093 (job 101257868494).

What did you do?

Repository: https://github.com/heymaikol/network-doctor

Primary reproducer:

go test ./internal/ui

Also observed under:

go test ./...

The fresh reproducing run https://github.com/heymaikol/network-doctor/actions/runs/33948156093 ran the literal command go test ./internal/ui on Go 1.27.0 and hung until the 20-minute outer GitHub Actions timeout, producing no package test output before cancellation.

Decisive discriminators (from paired runs on the same runner):

  • go build ./internal/ui completes
  • go list ./internal/ui completes
  • go test -c ./internal/ui -o ui.test.exe completes quickly (~2.6s)
  • the compiled test binary, invoked directly from package CWD internal/ui, passes with exit code 0 in about 55s
  • paired go test ./internal/ui can hang
  • isolated package testing is sufficient; ./... aggregation is not required

What did you see happen?

On GitHub-hosted Windows runners, go test ./internal/ui intermittently hangs before the package test binary is observed executing and never produces its normal package-level terminal result.

For aggregate testing, go test ./... can complete every other package while internal/ui never reports completion.

Evidence localizes the failure to cmd/go's orchestration path before the test binary is observed executing.

We do not claim an exact cmd/go scheduler race is proven, a specific lock or goroutine identified, or a precise cmd/go source location known. Direct invocation does not necessarily reproduce every flag, environment variable, pipe arrangement, or other invocation detail supplied by go test.

Process observer

https://github.com/heymaikol/network-doctor/actions/runs/33927281491

During the sustained pathological interval, the top-level go.exe remained alive, accumulated CPU time increased, and no persistent compile.exe, no persistent link.exe, and no *.test.exe were observed.

Other notable runs

Fresh environment + reproducer — https://github.com/heymaikol/network-doctor/actions/runs/33948156093
Exact Windows Go 1.27.0 go version and go env captured; literal go test ./internal/ui; hangs to the 20-minute outer timeout; no package test output before cancellation.

Corrected direct-binary discriminator — https://github.com/heymaikol/network-doctor/actions/runs/33938996888
go test -c ./internal/ui -o ui.test.exe succeeds in about 2.6s; the compiled binary run from package CWD internal/ui passes the full test suite with exit code 0 in about 55s; paired go test ./internal/ui hangs to the outer timeout.

Process observer — https://github.com/heymaikol/network-doctor/actions/runs/33927281491
As described above.

Go version A/B — https://github.com/heymaikol/network-doctor/actions/runs/33934720024
Go 1.27.0 hangs; Go 1.27.1 hangs.

Isolated package vs aggregate — https://github.com/heymaikol/network-doctor/actions/runs/33936232700
go test ./internal/ui hangs; go test ./... hangs with internal/ui lacking a terminal result; multi-package aggregation is not required.

First direct-binary discriminator — https://github.com/heymaikol/network-doctor/actions/runs/33937674466
Compile succeeds; the compiled test binary is accidentally launched from a wrong/non-package CWD; it executes but fails at TestJobStatusString because jobs.go cannot be found; paired go test ./internal/ui hangs; this led to the corrected-CWD run 33938996888.

Earlier successful diagnostic run — https://github.com/heymaikol/network-doctor/actions/runs/33914012572
Diagnostic jobs completed successfully, including successful compile-only construction; this run is not a hang.

Timing perturbations

-p 1 completed in some runs; an earlier -p=1 run also hung; -x completed in some runs. These are timing/execution perturbations only. -p 1 is not a reliable workaround, and -x is not recommended as a workaround.

What did you expect to see?

go test ./internal/ui should complete and produce a normal package-level result.

go test ./... should complete and produce a result for every package.

Maintainer request

  • What additional cmd/go diagnostics would be most useful during a hung process?
  • Is there a supported way to capture cmd/go scheduler / action-graph state?
  • What degree of minimization would be useful for a smaller reproducer?

Activity

  1. JunyangShao commented on Sep 11, 2026

    @JunyangShao
    Contributor

    @golang/go-command

  2. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions