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/compile/internal/ssa: "panic during regalloc" on linux/ppc64* #52924

Open
bcmills opened this issue May 16, 2022 · 15 comments
Open

cmd/compile/internal/ssa: "panic during regalloc" on linux/ppc64* #52924

bcmills opened this issue May 16, 2022 · 15 comments
Labels
arch-ppc64x compiler/runtime Issues related to the Go compiler and/or runtime. help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented May 16, 2022

#!watchflakes
post <- goarch ~ `ppc64.*` && log ~ `panic during regalloc` && log ~ `^\s*cmd/compile/internal/ssa`

greplogs -l -e '(?ms)panic during regalloc .*cmd/compile/internal/ssa\.\(\*sparseSet\)\.add'
2022-05-13T21:33:25-4170084/linux-ppc64le-power9osu

(attn @randall77 @dr2chase @cherrymui; CC @golang/ppc64)

@bcmills
Copy link
Contributor Author

bcmills commented May 16, 2022

# encoding/json [encoding/json.test]
go/src/encoding/json/decode_test.go:2438:70: internal compiler error: 'TestUnmarshalRescanLiteralMangledUnquote': panic during regalloc while compiling TestUnmarshalRescanLiteralMangledUnquote:

runtime error: invalid memory address or nil pointer dereference

goroutine 46 [running]:
cmd/compile/internal/ssa.Compile.func1()
	/workdir/go/src/cmd/compile/internal/ssa/compile.go:50 +0x7c
panic({0x85e800, 0xebf7c0})
	/workdir/go/src/runtime/panic.go:882 +0x238
cmd/compile/internal/ssa.(*sparseSet).add(...)
	/workdir/go/src/cmd/compile/internal/ssa/sparseset.go:39
cmd/compile/internal/ssa.(*sparseSet).addAll(...)
	/workdir/go/src/cmd/compile/internal/ssa/sparseset.go:45
cmd/compile/internal/ssa.(*stackAllocState).computeLive(0xc0029394a0?, {0xc000f50c00?, 0x38?, 0x203030203030302?})
	/workdir/go/src/cmd/compile/internal/ssa/stackalloc.go:367 +0xe38
cmd/compile/internal/ssa.(*stackAllocState).init(0xc0029394a0, 0xc0010101c0, {0xc000f50c00, 0x38, 0x38})
	/workdir/go/src/cmd/compile/internal/ssa/stackalloc.go:126 +0x150
cmd/compile/internal/ssa.stackalloc(0xc0010101c0, {0xc000f50c00, 0x38, 0x38})
	/workdir/go/src/cmd/compile/internal/ssa/stackalloc.go:88 +0x124
cmd/compile/internal/ssa.(*regAllocState).regalloc(0xc001154180, 0xc0010101c0)
	/workdir/go/src/cmd/compile/internal/ssa/regalloc.go:1833 +0x1f8
cmd/compile/internal/ssa.regalloc(0xc0010101c0?)
	/workdir/go/src/cmd/compile/internal/ssa/regalloc.go:148 +0x50
cmd/compile/internal/ssa.Compile(0xc0010101c0)
	/workdir/go/src/cmd/compile/internal/ssa/compile.go:98 +0x928
cmd/compile/internal/ssagen.buildssa(0xc0012717c0, 0x0)
	/workdir/go/src/cmd/compile/internal/ssagen/ssa.go:574 +0x1468
cmd/compile/internal/ssagen.Compile(0xc0012717c0, 0x0?)
	/workdir/go/src/cmd/compile/internal/ssagen/pgen.go:183 +0x48
cmd/compile/internal/gc.compileFunctions.func4.1(0x0?)
	/workdir/go/src/cmd/compile/internal/gc/compile.go:153 +0x4c
cmd/compile/internal/gc.compileFunctions.func3.1()
	/workdir/go/src/cmd/compile/internal/gc/compile.go:140 +0x54
created by cmd/compile/internal/gc.compileFunctions.func3
	/workdir/go/src/cmd/compile/internal/gc/compile.go:138 +0x8c

@bcmills
Copy link
Contributor Author

bcmills commented May 16, 2022

There have been several changes in stackalloc.go during the Go 1.19 cycle, so marking as release-blocker at least until we can determine whether this is a regression.

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels May 16, 2022
@bcmills bcmills added this to the Go1.19 milestone May 16, 2022
@dr2chase
Copy link
Contributor

It doesn't fail using the obvious cross-compilation:

GOOS=linux GOARCH=ppc64le go test -c encoding/json

which means, something wrong in that compiler?
About to try it on a gomote....

@bcmills
Copy link
Contributor Author

bcmills commented May 16, 2022

It only failed once in the builder — looks like a nondeterministic failure.

My guesses would be either a race or (given the ssa package) a runtime bug involving a mishandled OOM condition.

@dr2chase
Copy link
Contributor

Oh joy. I've already verified that it doesn't reproduce (once) with

GOPPC64=power9 GOOS=linux GOARCH=ppc64le go test -c encoding/json

nor (once) on a plain ppc64le gomote.

@dr2chase
Copy link
Contributor

On the failing builder, with a normally built compiler

for i in {1..100} ; do  go clean -cache ; go test -c encoding/json ; echo $i done ; done

over lunch worked fine.
Am about to retry with GOPPC64=power9 built compiler.

@ceseo
Copy link
Contributor

ceseo commented May 16, 2022

I can't reproduce it either (POWER9, with either GOPPC=power9 and GOPPC=power8.

@cherrymui
Copy link
Member

There have been several changes in stackalloc.go during the Go 1.19 cycle

I don't think we have recent changes in stackalloc.go. The most recent change I saw is https://go-review.googlesource.com/c/go/+/312292 , which is a year old.

I also built the compiler in race mode on PPC64LE and couldn't find a race or a crash in a reasonable amount of time.

Given the above, and it does not occur on a first class port, I think it is not a release blocker. Thanks.

@ianlancetaylor
Copy link
Contributor

As far as I can see this has happened exactly once.

Rolling forward to 1.20, but if it doesn't happen again we can close this.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.19, Go1.20 Jun 24, 2022
@bcmills
Copy link
Contributor Author

bcmills commented Sep 6, 2022

greplogs -l -e '(?ms)panic during regalloc .*cmd/compile/internal/ssa' --since=2022-05-16
2022-08-31T21:10:41-52d9e7f/linux-ppc64-sid-buildlet

@bcmills
Copy link
Contributor Author

bcmills commented Sep 6, 2022

(That time was in (*sparseMap).set, but it seems like a close enough fit.)

@bcmills bcmills changed the title cmd/compile/internal/ssa: "panic during regalloc" in (*sparseSet).add on linux/ppc64le cmd/compile/internal/ssa: "panic during regalloc" on linux/ppc64* Sep 6, 2022
@randall77
Copy link
Contributor

That last one looks like corruption to me. There's no way a negative number should appear in the slice involved (cmd/compile/internal/ssa.sparseMap.sparse). Entries start out 0 and every value assigned is known nonnegative.

@gopherbot gopherbot modified the milestones: Go1.20, Go1.21 Feb 1, 2023
@gopherbot gopherbot modified the milestones: Go1.21, Go1.22 Aug 8, 2023
@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. compiler/runtime Issues related to the Go compiler and/or runtime. labels Jan 2, 2024
@gopherbot
Copy link

Found new dashboard test flakes for:

#!watchflakes
post <- log ~ `panic during regalloc` && log ~ `^\s*cmd/compile/internal/ssa`
2023-11-20 18:34 linux-ppc64-sid-buildlet tools@bd215c0c go@e1dc209b github.com/yuin/goldmark/util [build] (log)
../../../../pkg/mod/github.com/yuin/goldmark@v1.4.13/util/html5entities.go:18:53: internal compiler error: 'init': panic during regalloc while compiling init:

runtime error: index out of range [134432465] with length 262144

goroutine 37 [running]:
cmd/compile/internal/ssa.Compile.func1()
	/workdir/go/src/cmd/compile/internal/ssa/compile.go:49 +0x7c
panic({0x939de0, 0xc003e42000})
	/workdir/go/src/runtime/panic.go:884 +0x240
cmd/compile/internal/ssa.(*sparseMapPos).set(...)
...
	/workdir/go/src/cmd/compile/internal/gc/compile.go:171 +0x4c
cmd/compile/internal/gc.compileFunctions.func3.1()
	/workdir/go/src/cmd/compile/internal/gc/compile.go:153 +0x44
created by cmd/compile/internal/gc.compileFunctions.func3
	/workdir/go/src/cmd/compile/internal/gc/compile.go:152 +0x1f4



Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

watchflakes

@bcmills bcmills removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 2, 2024
@mknyszek
Copy link
Contributor

CC @golang/ppc64

@pmur
Copy link
Contributor

pmur commented Jan 10, 2024

I suspect the most recent flake here is another manifestation of #64290. The failed index is 0x80346d1, and if the high bit is cleared, the index is valid.

@gopherbot gopherbot modified the milestones: Go1.22, Go1.23 Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-ppc64x compiler/runtime Issues related to the Go compiler and/or runtime. help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: No status
Status: No status
Development

No branches or pull requests

9 participants