Description
What version of Go are you using (go version
)?
$ go version go version go1.14.6 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env set GO111MODULE=on set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\guy.kempsell\AppData\Local\go-build set GOENV=C:\Users\guy.kempsell\AppData\Roaming\go\env set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GONOPROXY=**redacted** set GONOSUMDB=**redacted** set GOOS=windows set GOPATH=**redacted** set GOPRIVATE=**redacted** set GOPROXY=direct set GOROOT=C:\Users\guy.kempsell\sdk\go1.14.6 set GOSUMDB=off set GOTMPDIR= set GOTOOLDIR=C:\Users\guy.kempsell\sdk\go1.14.6\pkg\tool\windows_amd64 set GCCGO=gccgo set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD=C:\**redacted**\**redacted**\**redacted**\src\go.mod set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\GUY~1.KEM\AppData\Local\Temp\go-build260781202=/tmp/go-build -gno-record-gcc-switches
What did you do?
Updated to latest version of Go, although issue presented on 1.14.4 first.
Opened a project in Intellij IDEA that was working on Go 1.13 and tried to Run/Debug/Test.
Also tried Goland,VSCode and go cmds from the terminal. All ended with the same result.
What did you expect to see?
The application compiling and running correctly.
Or
Tests running correctly.
What did you see instead?
Frequent non-completion of compile process for both Run and Debug
Test stuck at initialising stage and not completing.
Additional Context
While I can repeat this pretty much every time with some existing projects, it is hard to do so with a fresh project.
The problem will occur 9 times out of 10 and there doesn't appear to be a consistent way of getting round it. Occasionally rerunning will be enough for it to work, sometimes closing and reopening the IDE will help; but more often than not nothing works.
After doing a bit of research I came across this issue: census-instrumentation/opencensus-go#1200
Which pointed me to the fact that calls to go get were effectively timing out, but updating Git resolved this.
I then tried go build -x to get additional output and it appears to be stuck at this step:
"C:\\Users\\guy.kempsell\\sdk\\go1.14.6\\pkg\\tool\\windows_amd64\\link.exe" -o "$WORK\\b001\\exe\\a.out.exe" -importcfg "$WORK\\b001\\importcfg.link" -buildmode=exe -buildid=_MkyF9LK9jUjX681GePM/clZjGxyzEU7znLXb1E2P/DcgycDdsw9oELtDtmgqC/_MkyF9LK9jUjX681GePM -extld=gcc "C:\\Users\\guy.kempsell\\AppData\\Local\\go-build\\02\\02244c9f2d6b3361c85447f0b49ca91dd8640f827dfda53b688b271ca3be44e5-d"
Activity
randall77 commentedon Jul 28, 2020
Looks like it hung in the linker.
If you can reproduce, can you try to attach a debugger to that process and get a backtrace?
@thanm @cherrymui
[-]cmd/go: build, run and test frequently fails to complete[/-][+]cmd/link: build, run and test frequently fails to complete[/+]alexbrainman commentedon Jul 29, 2020
I also have some Go build tools hanging on my machine - see #36492. @GKempsell perhaps you have the same bug. Try disabling preemption - that fixes #36492 problem. I only know how to disable preemption by changing Go runtime source code. Perhaps there is an easier way.
Alex
cherrymui commentedon Jul 29, 2020
You can set the environment variable
GODEBUG=asyncpreemptoff=1
.GKempsell commentedon Jul 30, 2020
Sorry for delay in coming back on this. Frustratingly, since you asked for the additional trace I've been unable to replicate the issue. I've gone from 95%+ replication success rate to 0%.
I haven't made any additional environment changes; I didn't even get round to trying with preempt turned off. So I doubt the issue has gone away permanently.
I guess I'll just have to keep an eye on it and if I do manage to replicate it again collect the trace information and send it over.
alexbrainman commentedon Jul 31, 2020
Thank you, @cherrymui. Indeed that worked here.
Alex
thanm commentedon Nov 30, 2022
Circling back on this issue; @GKempsell is this still a problem for? Can you still reproduce with the most recent Go release (1.19)? Thanks.
gopherbot commentedon Dec 30, 2022
Timed out in state WaitingForInfo. Closing.
(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)