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

go/types: SIGSEGV in (*Checker).exprInternal #37602

Open
bcmills opened this issue Mar 2, 2020 · 28 comments
Open

go/types: SIGSEGV in (*Checker).exprInternal #37602

bcmills opened this issue Mar 2, 2020 · 28 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. 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 Mar 2, 2020

#!watchflakes
post <- log ~ `SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)`

2020-03-01T21:04:30-a4f7b08/darwin-amd64-nocgo

    go_test.go:2345: # strings_test
        panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        	panic: runtime error: invalid memory address or nil pointer dereference
        [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x1215e20]
        
        goroutine 1 [running]:
        go/types.(*Checker).handleBailout(0xc000131680, 0xc00067f9f0)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/check.go:243 +0x98
        panic(0x12fe680, 0x15c1cf0)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/runtime/panic.go:967 +0x15d
        go/types.(*Checker).exprInternal(0xc000131680, 0xc0001c3d80, 0x0, 0x0, 0x0, 0x0, 0x30)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:1526 +0x1980
        go/types.(*Checker).rawExpr(0xc000131680, 0xc0001c3d80, 0x0, 0x0, 0x0, 0x0, 0x132b060)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:987 +0x81
        go/types.(*Checker).exprOrType(0xc000131680, 0xc0001c3d80, 0x0, 0x0)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:1644 +0x55
        go/types.(*Checker).call(0xc000131680, 0xc0001c3d80, 0xc00027f080, 0x4)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/call.go:15 +0x66
        go/types.(*Checker).exprInternal(0xc000131680, 0xc0001c3d80, 0x13ce0c0, 0xc00027f080, 0x0, 0x0, 0x11fbb58)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:1471 +0x1e61
        go/types.(*Checker).rawExpr(0xc000131680, 0xc0001c3d80, 0x13ce0c0, 0xc00027f080, 0x0, 0x0, 0x1)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:987 +0x81
        go/types.(*Checker).multiExpr(0xc000131680, 0xc0001c3d80, 0x13ce0c0, 0xc00027f080)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:1601 +0x58
        go/types.(*Checker).expr(0xc000131680, 0xc0001c3d80, 0x13ce0c0, 0xc00027f080)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:1595 +0x49
        go/types.(*Checker).exprInternal(0xc000131680, 0xc0001c3d80, 0x13ce1c0, 0xc00027f140, 0x13cb340, 0xc0000dce60, 0x100bb95)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:1145 +0x15be
        go/types.(*Checker).rawExpr(0xc000131680, 0xc0001c3d80, 0x13ce1c0, 0xc00027f140, 0x13cb340, 0xc0000dce60, 0x100c438)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:987 +0x81
        go/types.(*Checker).exprWithHint(0xc000131680, 0xc0001c3d80, 0x13ce1c0, 0xc00027f140, 0x13cb340, 0xc0000dce60)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:1623 +0x73
        go/types.(*Checker).indexedElts(0xc000131680, 0xc000246c00, 0xf, 0x10, 0x13cb340, 0xc0000dce60, 0xffffffffffffffff, 0xd)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:957 +0x1e2
        go/types.(*Checker).exprInternal(0xc000131680, 0xc0001c3400, 0x13ce1c0, 0xc00027f440, 0x0, 0x0, 0x0)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:1200 +0x584
        go/types.(*Checker).rawExpr(0xc000131680, 0xc0001c3400, 0x13ce1c0, 0xc00027f440, 0x0, 0x0, 0x0)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:987 +0x81
        go/types.(*Checker).multiExpr(0xc000131680, 0xc0001c3400, 0x13ce1c0, 0xc00027f440)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:1601 +0x58
        go/types.(*Checker).expr(0xc000131680, 0xc0001c3400, 0x13ce1c0, 0xc00027f440)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/expr.go:1595 +0x49
        go/types.(*Checker).varDecl(0xc000131680, 0xc000071220, 0xc00000f148, 0x1, 0x1, 0x0, 0x0, 0x13ce1c0, 0xc00027f440)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/decl.go:445 +0x187
        go/types.(*Checker).objDecl(0xc000131680, 0x13d3ca0, 0xc000071220, 0x0)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/decl.go:189 +0x666
        go/types.(*Checker).packageObjects(0xc000131680)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/resolver.go:570 +0x390
        go/types.(*Checker).checkFiles(0xc000131680, 0xc00025fc00, 0x7, 0x8, 0x0, 0x0)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/check.go:257 +0xa3
        go/types.(*Checker).Files(...)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/check.go:248
        go/types.(*Config).Check(0xc000358ac0, 0xc00012abd0, 0xc, 0xc00019c880, 0xc00025fc00, 0x7, 0x8, 0xc00035c5a0, 0x0, 0x16, ...)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/go/types/api.go:348 +0x14e
        cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.run(0xc00019c880, 0xc000134c60, 0xc000164600, 0x15, 0x20, 0x2e746c7573, 0x13d4660, 0x12fed40, 0xc00012a81c, 0xc000143c10)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:235 +0x42a
        cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.Run(0x7ffeefbff749, 0x83, 0xc000164600, 0x15, 0x20)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:131 +0x113
        cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.Main(0xc000164600, 0x15, 0x20)
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:118 +0x25f
        main.main()
        	/private/var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/vet/main.go:35 +0x2bd
        
    go_test.go:2345: go [test -cover -short math strings] failed unexpectedly in /var/folders/9w/4l2_g3kx01x199n37fbmv3s80000gn/T/workdir-host-darwin-10_14/go/src/cmd/go: exit status 2

This may be related to #36605, although the failures reported for that issue are supposed to be fixed in 1.14 and at tip (#36605 (comment)).

CC @matloob @griesemer

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 2, 2020
@bcmills bcmills added this to the Backlog milestone Mar 2, 2020
@bcmills
Copy link
Contributor Author

bcmills commented Mar 2, 2020

Whatever the source of memory corruption here is, it may also account for some or all of the crashes observed in #35541. Several of those include an exprInternal stack frame:

2020-02-26T17:58:41-a1103dc/linux-mips64le-mengzhuo
2020-02-21T22:00:03-240498d/linux-mips64le-mengzhuo
2019-12-20T23:07:52-4d5bb9c/linux-mips64le-mengzhuo

CC @mengzhuo

@matloob
Copy link
Contributor

matloob commented Mar 10, 2020

I think this is unrelated to #36605, because, as you mentioned, the underlying issue for that was fixed in 1.14. But the go/types code is complex, so I wouldn't be surprised at another race lurking there.

@bcmills

This comment was marked as outdated.

@bcmills

This comment was marked as outdated.

@bcmills

This comment was marked as outdated.

@bcmills
Copy link
Contributor Author

bcmills commented Mar 17, 2021

This one has a SIGSEGV in the collector, but exprInternal on one of the other call stacks:
https://build.golang.org/log/dc8b837f7f5de247bcd9f07144f6d18bec4fe2db

@bcmills

This comment was marked as outdated.

@bcmills
Copy link
Contributor Author

bcmills commented Mar 17, 2021

OTOH, the darwin failures were always pretty infrequent. Maybe those builders have just been luckier since January.

@bcmills
Copy link
Contributor Author

bcmills commented Feb 16, 2022

greplogs --dashboard -md -l -e 'SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)' --since=2022-02-01

2022-02-15T22:30:13-11109f6-6e82ff8/linux-ppc64-buildlet

greplogs --dashboard -md -l -e 'SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)' --since=2021-03-17 --omit=\(\?:openbsd-\|netbsd-\).\*

2021-10-25T21:03:33-5a40697-60c3069/freebsd-amd64-race
2021-09-09T21:49:46-295a39b-c981874/linux-riscv64-unmatched
2021-08-31T08:41:16-3e0d083-f118d14/linux-arm-arm5spacemonkey
2021-08-31T08:41:16-3e0d083-f118d14/linux-arm64-packet
2021-08-31T04:26:31-3e0d083-d384ebd/linux-arm-arm5spacemonkey
2021-08-30T22:09:22-3e0d083-7622e41/linux-arm-arm5spacemonkey
2021-08-30T20:08:45-3e0d083-61120c6/linux-arm-arm5spacemonkey
2021-08-30T17:13:00-3e0d083-b602dae/linux-arm-arm5spacemonkey
2021-08-30T02:40:46-3e0d083-56c3856/linux-arm-arm5spacemonkey
2021-08-30T01:55:58-3e0d083-a29d9aa/linux-arm-arm5spacemonkey
2021-08-25T03:13:06-c32dd46-e1fcf88/linux-arm-arm5spacemonkey
2021-08-25T03:07:54-c32dd46-41b99da/linux-arm-arm5spacemonkey
2021-08-24T22:23:12-c32dd46-54cdef1/linux-arm-arm5spacemonkey
2021-08-24T18:31:34-c32dd46-c2f96e6/linux-arm-arm5spacemonkey
2021-08-24T14:51:57-c32dd46-8eeb1bf/linux-arm-arm5spacemonkey
2021-08-24T00:01:29-d4cc65f-8eeb1bf/linux-arm-arm5spacemonkey
2021-08-23T21:22:58-d4cc65f-8157960/linux-arm-arm5spacemonkey
2021-08-23T19:27:46-d4cc65f-3081f81/linux-arm-arm5spacemonkey
2021-08-23T03:39:14-d4cc65f-457418b/linux-arm-arm5spacemonkey
2021-08-22T23:49:55-d4cc65f-86ee892/linux-arm-arm5spacemonkey
2021-05-05T22:35:07-dd255f2-ba7cac4/linux-arm-scaleway
2021-04-30T16:06:43-9b9633e-72ccabc/linux-arm-scaleway
2021-04-08T19:22:05-be791d0-8c163e8/linux-arm-scaleway
2021-04-08T02:08:45-b261fe9-8c163e8/linux-arm-scaleway
2021-04-07T10:44:45-3ac76b8-8c163e8/linux-arm-scaleway

@bcmills bcmills added the compiler/runtime Issues related to the Go compiler and/or runtime. label May 3, 2023
@mknyszek
Copy link
Contributor

mknyszek commented May 3, 2023

The latest failure here was #59910 (just to point it out explicitly). @cherrymui notes she tried reproducing this in the past on a gomote but couldn't. I'm not sure what the next steps are here. Is #59910 the only one in recent memory? I'll take a look at the history.

At face value, the pattern here seems to maybe be weak memory architectures?

@mknyszek mknyszek self-assigned this May 3, 2023
@griesemer
Copy link
Contributor

cc @findleyr for visibility. @findleyr has been working on parallelizing some of the tests but I believe that CL has not yet landed, so can't be the culprit.

@bcmills
Copy link
Contributor Author

bcmills commented May 3, 2023

Is #59910 the only one in recent memory?

From a cursory GitHub search,

is the only other recent report that looks related.

@findleyr
Copy link
Contributor

findleyr commented May 3, 2023

FWIW #59080 also looks like an inexplicable NPE on ppc64.

@gopherbot
Copy link

Found new dashboard test flakes for:

#!watchflakes
post <- log ~ `SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)`
2023-05-01 14:33 linux-ppc64le-buildlet tools@7590fe4d go@069f9fb2 x/tools/go/analysis/passes/httpresponse (log)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x5 pc=0x18354]

goroutine 119 [running]:
go/types.(*Checker).handleBailout(0xc0002f7e00, 0xc000115b40)
	/workdir/go/src/go/types/check.go:335 +0xc0
panic({0x2ac2c0?, 0x4c4300?})
	/workdir/go/src/runtime/panic.go:914 +0x27c
go/types.(*Scope).Lookup(...)
...
sync.(*Once).doSlow(0x0?, 0x0?)
	/workdir/go/src/sync/once.go:74 +0x110
sync.(*Once).Do(...)
	/workdir/go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
	/workdir/gopath/src/golang.org/x/tools/go/packages/packages.go:839 +0x80
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
	/workdir/gopath/src/golang.org/x/tools/go/packages/packages.go:846 +0x40
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 114
	/workdir/gopath/src/golang.org/x/tools/go/packages/packages.go:845 +0x98

watchflakes

@findleyr
Copy link
Contributor

findleyr commented May 4, 2023

These recent failures to me indicate a bug on ppc64.

CC @golang/ppc64

@gopherbot
Copy link

Found new dashboard test flakes for:

#!watchflakes
post <- log ~ `SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)`
2023-05-25 16:41 darwin-amd64-11_0 tools@ed90c6d2 go@789701e9 x/tools/gopls/internal/regtest/diagnostics.TestIssue37978 (log)
SIGSEGV: segmentation violation
PC=0x10002d111 m=13 sigcode=1

rax    0x101457440
rbx    0xc00c100000
rcx    0x4
rdx    0x0
rdi    0x800000000000
rsi    0x0
rbp    0x70000d451be0
...
	/tmp/buildlet/go/src/runtime/chan.go:442 +0x12 fp=0xc00006fd58 sp=0xc00006fd30 pc=0x10000b4d2
testing.(*T).Run(0xc0012311e0, {0x100b7333d?, 0x100b8fe94?}, 0xc000412910)
	/tmp/buildlet/go/src/testing/testing.go:1649 +0x3c8 fp=0xc00006fe18 sp=0xc00006fd58 pc=0x100131208
golang.org/x/tools/gopls/internal/lsp/regtest.(*Runner).Run(0xc000534640, 0xc0012311e0, {0x100bde6dc, 0x7c}, 0x100cf4608, {0x0, 0x0, 0x10009528f?})
	/tmp/buildlet/gopath/src/golang.org/x/tools/gopls/internal/lsp/regtest/runner.go:169 +0x491 fp=0xc00006ff20 sp=0xc00006fe18 pc=0x10096df11
golang.org/x/tools/gopls/internal/lsp/regtest.Run(...)
	/tmp/buildlet/gopath/src/golang.org/x/tools/gopls/internal/lsp/regtest/regtest.go:54
golang.org/x/tools/gopls/internal/regtest/diagnostics.TestIssue37978(0x100e25c30?)
	/tmp/buildlet/gopath/src/golang.org/x/tools/gopls/internal/regtest/diagnostics/diagnostics_test.go:163 +0x3d fp=0xc00006ff70 sp=0xc00006ff20 pc=0x1009768bd
testing.tRunner(0xc0012311e0, 0x100cf4298)

watchflakes

@gopherbot
Copy link

Found new dashboard test flakes for:

#!watchflakes
post <- log ~ `SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)`
2023-06-22 21:46 darwin-amd64-12_0 tools@c8278fe9 go@6dce882b x/tools/go/packages.TestAll (log)
SIGSEGV: segmentation violation
PC=0x10275f1 m=6 sigcode=1

rax    0x14ecde0
rbx    0xc040038000
rcx    0x3e
rdx    0x0
rdi    0x800000000000
rsi    0x0
rbp    0x700003522e20
...
	/tmp/buildlet/go/src/runtime/chan.go:442 +0x12 fp=0xc000064d50 sp=0xc000064d28 pc=0x1005f32
testing.(*T).Run(0xc006eb9d40, {0xc000ba7440?, 0x1?}, 0xc02487b020)
	/tmp/buildlet/go/src/testing/testing.go:1649 +0x3c8 fp=0xc000064e10 sp=0xc000064d50 pc=0x10ebb08
golang.org/x/tools/go/packages_test.testCgoNoSyntax(0xc006eb9d40?, {0x134a850, 0x1503860})
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/packages_test.go:1929 +0x228 fp=0xc000064ed8 sp=0xc000064e10 pc=0x12639e8
golang.org/x/tools/go/packages_test.testAllOrModulesParallel.func1(0xc006eb9d40, {0x134a850, 0x1503860})
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/packages_test.go:81 +0x138 fp=0xc000064f30 sp=0xc000064ed8 pc=0x1253db8
golang.org/x/tools/go/packages/packagestest.TestAll.func1(0xc006eb9d40)
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/packagestest/export.go:162 +0x51 fp=0xc000064f70 sp=0xc000064f30 pc=0x1242ad1
testing.tRunner(0xc006eb9d40, 0xc00bbe14e0)

watchflakes

@bcmills
Copy link
Contributor Author

bcmills commented Jun 23, 2023

Two recent failures on darwin/amd64. That doesn't seem consistent with a PPC64-specific bug, but maybe we're seeing similar symptoms from two different bugs.

(Perhaps the PPC64 failures were another symptom of #60368? If so, that suggests that the darwin/amd64 failures may also be symptomatic of register corruption.)

@gopherbot
Copy link

Found new dashboard test flakes for:

#!watchflakes
post <- log ~ `SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)`
2023-07-06 20:34 darwin-amd64-12_0 tools@124ebfa4 go@312920c0 x/tools/go/analysis/passes/composite.Test (log)
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1026791]

runtime stack:
runtime.throw({0x1318172?, 0x0?})
	/tmp/buildlet/go/src/runtime/panic.go:1047 +0x5d fp=0x700001ea5b98 sp=0x700001ea5b68 pc=0x10352bd
runtime.sigpanic()
	/tmp/buildlet/go/src/runtime/signal_unix.go:825 +0x3e9 fp=0x700001ea5bf8 sp=0x700001ea5b98 pc=0x104c369
runtime.(*mheap).allocNeedsZero(0xc0040ca000?, 0x4?, 0x102b8b9?)
	/tmp/buildlet/go/src/runtime/mheap.go:1021 +0x71 fp=0x700001ea5c18 sp=0x700001ea5bf8 pc=0x1026791
...
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/packages.go:266 +0x9c fp=0xc0001094e8 sp=0xc0001094b0 pc=0x127ac5c
golang.org/x/tools/go/analysis/analysistest.loadPackages(0x14fc4c0, {0xc00008c2a0, 0x51}, {0xc0000d4b00, 0x2, 0x2})
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/analysis/analysistest/analysistest.go:332 +0x225 fp=0xc000109630 sp=0xc0001094e8 pc=0x12912e5
golang.org/x/tools/go/analysis/analysistest.Run({0x136fc20, 0xc000083040}, {0xc00008c2a0, 0x51}, 0x14fc4c0, {0xc0000d4b00, 0x2, 0x2})
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/analysis/analysistest/analysistest.go:286 +0xbf fp=0xc0001096f8 sp=0xc000109630 pc=0x1290cff
golang.org/x/tools/go/analysis/analysistest.RunWithSuggestedFixes({0x136fc20, 0xc000083040}, {0xc00008c2a0?, 0x51?}, 0x14fc4c0?, {0xc0000d4b00?, 0x2?, 0x2?})
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/analysis/analysistest/analysistest.go:102 +0x4e fp=0xc000109f08 sp=0xc0001096f8 pc=0x128efee
golang.org/x/tools/go/analysis/passes/composite_test.Test(0x0?)
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/analysis/passes/composite/composite_test.go:21 +0xc6 fp=0xc000109f70 sp=0xc000109f08 pc=0x12943a6
testing.tRunner(0xc000083040, 0x131fa40)

watchflakes

@gopherbot
Copy link

Found new dashboard test flakes for:

#!watchflakes
post <- log ~ `SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)`
2023-08-01 19:50 linux-riscv64-unmatched vuln@b2f5f90c go@ce5e37ec path/filepath [build] (log)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x13 pc=0x1b2f20]

goroutine 1 [running]:
go/types.(*Checker).handleBailout(0x3f8c140000, 0x3f8c249a48)
	go/types/check.go:336 +0xa8
panic({0x2af540?, 0x5231e0?})
	runtime/panic.go:612 +0x110
go/types.varTypes(...)
...
go/types.(*Config).Check(0x3f8c199080, {0x3f8c00d490?, 0x3f8c00c067?}, 0x3f8c10cdc0, {0x3f8c1fc9c0, 0x5, 0x8}, 0x3f8c1dbc20)
	go/types/api.go:425 +0x18c
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.run(0x3f8c10cdc0, 0x3f8c0e00e0, {0x3f8c0c0f00, 0x1c, 0x1e?})
	cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:235 +0x45c
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.Run({0x3fff9808e3?, 0x1e?}, {0x3f8c0c0f00, 0x1c, 0x20})
	cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:133 +0xbc
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.Main({0x3f8c10a000, 0x1e, 0x1e})
	cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:120 +0x34c
main.main()
	cmd/vet/main.go:47 +0x430

watchflakes

@gopherbot
Copy link

Found new dashboard test flakes for:

#!watchflakes
post <- log ~ `SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)`
2023-08-14 16:17 darwin-amd64-11_0 tools@fa12f34b go@60506f4d x/tools/go/packages.TestAll (log)
SIGSEGV: segmentation violation
PC=0x3b037e2 m=8 sigcode=1

rax    0xc028e29480
rbx    0xc000029240
rcx    0xc028e29480
rdx    0x0
rdi    0x0
rsi    0x20300a
rbp    0x700000710e98
...
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/packages.go:783 +0xdcb fp=0xc000911d48 sp=0xc000911a50 pc=0x3d1ad8b
golang.org/x/tools/go/packages.Load(0x3dea240?, {0xc025935c80, 0x1, 0x1})
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/packages.go:268 +0x107 fp=0xc000911d88 sp=0xc000911d48 pc=0x3d19167
golang.org/x/tools/go/packages_test.testAddImportInOverlay(0xc0132321a0, {0x3e35500, 0x3fe88a0})
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/overlay_test.go:940 +0x3eb fp=0xc000911ed8 sp=0xc000911d88 pc=0x3d36c2b
golang.org/x/tools/go/packages_test.testAllOrModulesParallel.func1(0xc0132321a0, {0x3e35500, 0x3fe88a0})
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/packages_test.go:81 +0x138 fp=0xc000911f30 sp=0xc000911ed8 pc=0x3d38878
golang.org/x/tools/go/packages/packagestest.TestAll.func1(0xc0132321a0)
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/packagestest/export.go:162 +0x51 fp=0xc000911f70 sp=0xc000911f30 pc=0x3d27551
testing.tRunner(0xc0132321a0, 0xc004fcace0)

watchflakes

@findleyr
Copy link
Contributor

The linux-riscv64-unmatched failure is #61932.

Is a go/types race implicated here? Could/would that cause the types of SIGSEGVs we see in garbage collection?

Another consideration is that go/types is the leading cause of allocation in a lot of tests.

@bcmills
Copy link
Contributor Author

bcmills commented Aug 18, 2023

Personally my theory is that go/types is triggering some kind of defer bug in the runtime and/or compiler.
It is, to my knowledge, one of the only places in the standard library where we use a recover of an explicit panic in normal operation:
https://cs.opensource.google/go/go/+/master:src/go/types/check.go;l=329-341;drc=2420cc0d00fccb28c4d155941b2853c14bee4e34

(fmt does recover panics too, but they're usually nil-deferences rather than explicit panic statements and the defer/recover pairing is much more immediate.)

@gopherbot
Copy link

Found new dashboard test flakes for:

#!watchflakes
post <- log ~ `SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)`
2023-09-09 01:48 linux-riscv64-unmatched go@ee788dba crypto/x509 [build] (log)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x1cc418]

goroutine 1 [running]:
panic({0x2afce0?, 0x523250?})
	runtime/panic.go:774 +0x12c fp=0x3f7494bc18 sp=0x3f7494bb70 pc=0x44fbc
go/types.(*Checker).handleBailout(0x3f74480000, 0x3f7494fa48)
	go/types/check.go:339 +0xa8 fp=0x3f7494bc30 sp=0x3f7494bc18 pc=0x1b97e0
go/types.(*Checker).checkFiles.deferwrap1()
...
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.Run({0x3fdbf377ec?, 0x1e?}, {0x3f74104f00, 0x1c, 0x20})
	cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:133 +0xbc fp=0x3f7494fe78 sp=0x3f7494fc70 pc=0x23aa9c
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.Main({0x3f7414c000, 0x1e, 0x1e})
	cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:120 +0x34c fp=0x3f7494ff20 sp=0x3f7494fe78 pc=0x23a90c
main.main()
	cmd/vet/main.go:47 +0x430 fp=0x3f7494ff60 sp=0x3f7494ff20 pc=0x27ea90
runtime.main()
	runtime/proc.go:267 +0x2b0 fp=0x3f7494ffd8 sp=0x3f7494ff60 pc=0x483d8
runtime.goexit({})
	runtime/asm_riscv64.s:512 +0x4 fp=0x3f7494ffd8 sp=0x3f7494ffd8 pc=0x755c4

watchflakes

@gopherbot
Copy link

Found new dashboard test flakes for:

#!watchflakes
post <- log ~ `SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)`
2023-10-10 15:06 darwin-amd64-12_0 tools@8954aa7a go@aa8e4c5e x/tools/gopls/internal/regtest/diagnostics.TestIssue37978 (log)
SIGSEGV: segmentation violation
PC=0x10e80e071 m=16 sigcode=1 addr=0x0

rax    0x10fdbbe60
rbx    0xc00c1a8000
rcx    0xf7
rdx    0x0
rdi    0x800000000000
rsi    0x0
rbp    0x70000b84fe08
...
	/tmp/buildlet/go/src/runtime/chan.go:442 +0x12 fp=0xc00006fd50 sp=0xc00006fd28 pc=0x10e7ebaf2
testing.(*T).Run(0xc001ba21a0, {0x10f227c69?, 0x10f24519e?}, 0xc004965db0)
	/tmp/buildlet/go/src/testing/testing.go:1647 +0x3ab fp=0xc00006fe10 sp=0xc00006fd50 pc=0x10e9176ab
golang.org/x/tools/gopls/internal/lsp/regtest.(*Runner).Run(0xc0004fabe0, 0xc001ba21a0, {0x10f298a05, 0x7c}, 0x10f707b88, {0x0?, 0x0, 0x10e87664f?})
	/tmp/buildlet/gopath/src/golang.org/x/tools/gopls/internal/lsp/regtest/runner.go:168 +0x485 fp=0xc00006ff20 sp=0xc00006fe10 pc=0x10f208585
golang.org/x/tools/gopls/internal/lsp/regtest.Run(...)
	/tmp/buildlet/gopath/src/golang.org/x/tools/gopls/internal/lsp/regtest/regtest.go:53
golang.org/x/tools/gopls/internal/regtest/diagnostics.TestIssue37978(0xc00073e748?)
	/tmp/buildlet/gopath/src/golang.org/x/tools/gopls/internal/regtest/diagnostics/diagnostics_test.go:163 +0x3d fp=0xc00006ff70 sp=0xc00006ff20 pc=0x10f2109fd
testing.tRunner(0xc001ba21a0, 0x10f707830)

watchflakes

@gopherbot
Copy link

Found new dashboard test flakes for:

#!watchflakes
post <- log ~ `SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)`
2023-10-30 18:50 darwin-amd64-nocgo tools@9cf559ce go@f9a31cda x/tools/internal/refactor/inline.TestData (log)
SIGSEGV: segmentation violation
PC=0x101f322 m=5 sigcode=1

rax    0xc001244990
rbx    0xc000034b40
rcx    0xc001244990
rdx    0x0
rdi    0x13b4548
rsi    0x203000
rbp    0x7000054b3e98
...
	/tmp/buildlet/go/src/runtime/sema.go:62 +0x25 fp=0xc000093940 sp=0xc000093908 pc=0x1066e45
sync.(*WaitGroup).Wait(0xc0005310e0?)
	/tmp/buildlet/go/src/sync/waitgroup.go:116 +0x48 fp=0xc000093968 sp=0xc000093940 pc=0x10730c8
golang.org/x/tools/go/packages.(*loader).refine(0xc0002e09a0, 0xc000372ba0)
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/packages.go:801 +0xd4b fp=0xc000093bd8 sp=0xc000093968 pc=0x12d888b
golang.org/x/tools/go/packages.Load(0xc000320000?, {0xc000355990, 0x1, 0x1})
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/packages.go:286 +0x2b5 fp=0xc000093c48 sp=0xc000093bd8 pc=0x12d6cb5
golang.org/x/tools/internal/refactor/inline_test.TestData.func1(0xc0003fe1a0)
	/tmp/buildlet/gopath/src/golang.org/x/tools/internal/refactor/inline/inline_test.go:74 +0x2d9 fp=0xc000093f70 sp=0xc000093c48 pc=0x12ed479
testing.tRunner(0xc0003fe1a0, 0xc0002da048)

watchflakes

@gopherbot
Copy link

Found new dashboard test flakes for:

#!watchflakes
post <- log ~ `SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)`
2023-11-07 21:16 darwin-amd64-12_0 tools@51df92b2 go@9e90a15b x/tools/gopls/internal/regtest/diagnostics.TestIssue37978 (log)
SIGSEGV: segmentation violation
PC=0x8b198c5 m=12 sigcode=1 addr=0x0

rax    0xa0d4020
rbx    0xc00c002000
rcx    0x55
rdx    0x0
rdi    0x0
rsi    0x800000000000
rbp    0x700010a0ee08
...
	/tmp/buildlet/go/src/runtime/chan.go:442 +0x12 fp=0xc000074d50 sp=0xc000074d28 pc=0x8af7372
testing.(*T).Run(0xc00252b040, {0x953a161?, 0x9557799?}, 0xc00250aa00)
	/tmp/buildlet/go/src/testing/testing.go:1736 +0x3ab fp=0xc000074e10 sp=0xc000074d50 pc=0x8c2382b
golang.org/x/tools/gopls/internal/lsp/regtest.(*Runner).Run(0xc0001268c0, 0xc00252b040, {0x95ab907, 0x7c}, 0x9a1d618, {0x0?, 0x0, 0x8b81fcf?})
	/tmp/buildlet/gopath/src/golang.org/x/tools/gopls/internal/lsp/regtest/runner.go:168 +0x485 fp=0xc000074f20 sp=0xc000074e10 pc=0x951b105
golang.org/x/tools/gopls/internal/lsp/regtest.Run(...)
	/tmp/buildlet/gopath/src/golang.org/x/tools/gopls/internal/lsp/regtest/regtest.go:53
golang.org/x/tools/gopls/internal/regtest/diagnostics.TestIssue37978(0xc00252b040?)
	/tmp/buildlet/gopath/src/golang.org/x/tools/gopls/internal/regtest/diagnostics/diagnostics_test.go:163 +0x3d fp=0xc000074f70 sp=0xc000074f20 pc=0x952361d
testing.tRunner(0xc00252b040, 0x9a1d2b8)

watchflakes

@gopherbot
Copy link

Found new dashboard test flakes for:

#!watchflakes
post <- log ~ `SIGSEGV(.*\n)*\ngoroutine \d+ \[.+\]:\n(\s*.+\n)*go/types\.\(\*Checker\)\.(?:rawExpr|exprInternal)`
2024-01-22 20:52 darwin-amd64-11_0 tools@e2ca5942 go@a95136a8 x/tools/go/analysis/passes/stdmethods.TestAnalyzeEncodingXML (log)
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1026791]

runtime stack:
runtime.throw({0x12e4d8e?, 0x14b5700?})
	/tmp/buildlet/go/src/runtime/panic.go:1047 +0x5d fp=0x7ffeefbff6c8 sp=0x7ffeefbff698 pc=0x103535d
runtime.sigpanic()
	/tmp/buildlet/go/src/runtime/signal_unix.go:825 +0x3e9 fp=0x7ffeefbff728 sp=0x7ffeefbff6c8 pc=0x104c409
runtime.(*mheap).allocNeedsZero(0xc00c100000?, 0x7c?, 0x180?)
	/tmp/buildlet/go/src/runtime/mheap.go:1021 +0x71 fp=0x7ffeefbff748 sp=0x7ffeefbff728 pc=0x1026791
...
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/packages.go:758 +0xd77 fp=0xc00650dc48 sp=0xc00650d9d8 pc=0x1258317
golang.org/x/tools/go/packages.Load(0xc0003c12c0?, {0xc007dd4a70, 0x1, 0x1})
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/packages/packages.go:249 +0x2c7 fp=0xc00650dcc0 sp=0xc00650dc48 pc=0x12566e7
golang.org/x/tools/go/analysis/analysistest.loadPackages(0x14b03e0, {0x0, 0x0}, {0xc007dd4a70, 0x1, 0x1})
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/analysis/analysistest/analysistest.go:375 +0x29a fp=0xc00650de50 sp=0xc00650dcc0 pc=0x126361a
golang.org/x/tools/go/analysis/analysistest.Run({0x13375a0, 0xc007abb860}, {0x0, 0x0}, 0x14b03e0, {0xc007dd4a70, 0x1, 0x1})
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/analysis/analysistest/analysistest.go:322 +0xbf fp=0xc00650df18 sp=0xc00650de50 pc=0x1262fbf
golang.org/x/tools/go/analysis/passes/stdmethods_test.TestAnalyzeEncodingXML(0x100523d?)
	/tmp/buildlet/gopath/src/golang.org/x/tools/go/analysis/passes/stdmethods/stdmethods_test.go:20 +0x5f fp=0xc00650df70 sp=0xc00650df18 pc=0x126673f
testing.tRunner(0xc007abb860, 0x12ec930)

watchflakes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: No status
Development

No branches or pull requests

6 participants