Skip to content

misc/cgo/test: Test9400 in TestCrossPackageTests hangs on ppc64le #49695

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

Closed
pmur opened this issue Nov 19, 2021 · 4 comments
Closed

misc/cgo/test: Test9400 in TestCrossPackageTests hangs on ppc64le #49695

pmur opened this issue Nov 19, 2021 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@pmur
Copy link
Contributor

pmur commented Nov 19, 2021

While trying to reproduce some sporadic failures on seen on the ppc64le CI machines, I came across a hang in Test9400 on a POWER10 machine with GOMAXPROCS=2.

What version of Go are you using (go version)?

$ go version
go version devel go1.18-e8cda0a6c9 Fri Nov 19 00:05:59 2021 +0000 linux/ppc64le

What did you do?

cd $GOPATH/misc/cgo/test
go test -buildmode=pie -ldflags=-linkmode=internal -tags=internal,internal_pie -c
export GOMAXPROCS=2
while [ 1 ]; do ./test.test -test.v -test.short ; done

Eventually this hangs on TestCrossPackageTests running Test9400.

This kind of looks like it may be an untimely GC starting while issue9400.RewindAndSetgid is spinning on a condition.

I inserted a call to runtime.GC prior to the above call, and was unable to reproduce the hang.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/365836 mentions this issue: misc/cgo/test: reduce likeliness of hang in Test9400

@heschi heschi added the NeedsFix The path to resolution is known, but the work has not been done. label Nov 22, 2021
@heschi heschi added this to the Go1.18 milestone Nov 22, 2021
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/367874 mentions this issue: misc/cgo/test: further reduce likeliness of hang in Test9400

gopherbot pushed a commit that referenced this issue Nov 30, 2021
As suggested by #49680, a GC could be in-progress when we
disable GC. Force a GC after we pause to ensure we don't
hang in this case.

For #49695

Change-Id: I4fc4c06ef2ac174217c3dcf7d58c7669226e2d24
Reviewed-on: https://go-review.googlesource.com/c/go/+/367874
Run-TryBot: Paul Murphy <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Trust: Paul Murphy <[email protected]>
@mknyszek
Copy link
Contributor

mknyszek commented Dec 7, 2021

Update on the root cause here: the fixes for #49680, #49695, and #45867 all assumed that SetGCPercent(-1) doesn't block until the GC's mark phase is done, but it actually does. The cause of those failures is that at the beginning of the sweep phase, the GC does try to preempt every P once, and this may run concurrently with test code that has non-preemptible goroutines that create the potential for a deadlock.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/369815 mentions this issue: runtime: fix comments on the behavior of SetGCPercent

gopherbot pushed a commit that referenced this issue Dec 7, 2021
Fixes for #49680, #49695, #45867, and #49370 all assumed that
SetGCPercent(-1) doesn't block until the GC's mark phase is done, but
it actually does. The cause of 3 of those 4 failures comes from the fact
that at the beginning of the sweep phase, the GC does try to preempt
every P once, and this may run concurrently with test code. In the
fourth case, the issue was likely that only *one* of the debug_test.go
tests was missing a call to SetGCPercent(-1). Just to be safe, leave a
TODO there for now to remove the extraneous runtime.GC calls, but leave
the calls in.

Updates #49680, #49695, #45867, and #49370.

Change-Id: Ibf4e64addfba18312526968bcf40f1f5d54eb3f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/369815
Reviewed-by: Austin Clements <[email protected]>
Trust: Michael Knyszek <[email protected]>
Run-TryBot: Michael Knyszek <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
@golang golang locked and limited conversation to collaborators Dec 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants