Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: build, run and test frequently fails to complete #40445

Closed
GKempsell opened this issue Jul 28, 2020 · 7 comments
Closed

cmd/link: build, run and test frequently fails to complete #40445

GKempsell opened this issue Jul 28, 2020 · 7 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@GKempsell
Copy link

GKempsell commented Jul 28, 2020

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"

@randall77
Copy link
Contributor

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

@cagedmantis cagedmantis added this to the Backlog milestone Jul 28, 2020
@cagedmantis cagedmantis changed the title cmd/go: build, run and test frequently fails to complete cmd/link: build, run and test frequently fails to complete Jul 28, 2020
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 28, 2020
@alexbrainman
Copy link
Member

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
Copy link
Member

how to disable preemption

You can set the environment variable GODEBUG=asyncpreemptoff=1.

@GKempsell
Copy link
Author

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
Copy link
Member

You can set the environment variable GODEBUG=asyncpreemptoff=1.

Thank you, @cherrymui. Indeed that worked here.

Alex

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
@thanm thanm added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 30, 2022
@thanm
Copy link
Contributor

thanm commented 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
Copy link

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.)

@golang golang locked and limited conversation to collaborators Dec 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

7 participants