Skip to content

go/types: nil pointer exception in Checker.allowVersion #61822

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
findleyr opened this issue Aug 7, 2023 · 1 comment
Closed

go/types: nil pointer exception in Checker.allowVersion #61822

findleyr opened this issue Aug 7, 2023 · 1 comment
Assignees
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@findleyr
Copy link
Member

findleyr commented Aug 7, 2023

From x/telemetry build failures:
https://build.golang.org/log/2d191343b496feff9fb3cd86a6e699d43127630a

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=0x18 pc=0x61d64c]

goroutine 1 [running]:
go/types.(*Checker).handleBailout(0xc0001b6000, 0xc00033ba00)
	go/types/check.go:339 +0x88
panic({0x6d5920?, 0x92a0e0?})
	runtime/panic.go:612 +0x132
go/token.(*File).Pos(...)
	go/token/position.go:268
go/types.(*Checker).allowVersion(0xc0001b6000, 0xc00007d920?, {0x7945c0?, 0x9227e0?}, {0x40d2a5?, 0x30?})
linux-amd64 at 65d4723 building telemetry at 6b1207f8206a1faf0c958750d7e9f325334576e4

:: Running /workdir/go/bin/go with args ["/workdir/go/bin/go" "test" "-short" "./..."] and env ["HOSTNAME=buildlet-linux-amd64-bullseye-rn552a163" "HOME=/root" "SHLVL=0" "DEBIAN_FRONTEND=noninteractive" "USER=root" "GO_STAGE0_NET_DELAY=0s" "GO_STAGE0_DL_DELAY=200ms" "WORKDIR=/workdir" "GOROOT_BOOTSTRAP=/workdir/go1.4" "GO_BUILDER_NAME=linux-amd64" "GO_DISABLE_OUTBOUND_NETWORK=1" "GOROOT=/workdir/go" "GOPATH=/workdir/gopath" "GOPROXY=http://gk3-services-nap-jetxd907-8f582974-u4g3.c.symbolic-datum-552.internal:30157" "TMPDIR=/workdir/tmp" "GOCACHE=/workdir/gocache" "GOPLSCACHE=/workdir/goplscache" "PATH=/workdir/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" "PWD=/workdir/gopath/src/golang.org/x/telemetry"] in dir /workdir/gopath/src/golang.org/x/telemetry

go: downloading golang.org/x/mod v0.10.0
? golang.org/x/telemetry [no test files]

golang.org/x/telemetry/counter/countertest

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=0x18 pc=0x61d64c]

goroutine 1 [running]:
go/types.(*Checker).handleBailout(0xc0001b6000, 0xc00033ba00)
go/types/check.go:339 +0x88
panic({0x6d5920?, 0x92a0e0?})
runtime/panic.go:612 +0x132
go/token.(*File).Pos(...)
go/token/position.go:268
go/types.(*Checker).allowVersion(0xc0001b6000, 0xc00007d920?, {0x7945c0?, 0x9227e0?}, {0x40d2a5?, 0x30?})
go/types/version.go:136 +0x6c
go/types.(*Checker).verifyVersionf(0xc0001b6000, {0x7945c0, 0x9227e0}, {0xc00033a248?, 0x0?}, {0x72913c, 0x1e}, {0xc00033a2f8, 0x1, 0x1})
go/types/version.go:150 +0x68
go/types.computeInterfaceTypeSet(0xc0001b6000, 0x6172cb?, 0xc00044f860)
go/types/typeset.go:280 +0x6e5
go/types.(*Interface).typeSet(...)
go/types/interface.go:29
go/types.(*Interface).Empty(0x7951b0?)
go/types/interface.go:120 +0x25
go/types.(*Checker).implements(0xc0001b6000, 0xf73, {0x795070?, 0xc000412e90}, {0x7951b0?, 0xc00044f860}, 0x1, 0xc00033a6e0)
go/types/instantiate.go:224 +0x46d
go/types.(*Checker).verify(0xc000271cd0?, 0xc00033a7b0?, {0xc000584ce0?, 0x2, 0x6d1ec0?}, {0xc0004e12a0?, 0x2, 0x6d1ec0?}, 0x4323d9f5cd864f8f?)
go/types/instantiate.go:181 +0x145
go/types.(*Checker).instantiateSignature.func2()
go/types/call.go:159 +0x185
go/types.(*Checker).processDelayed(0xc0001b6000, 0x26)
go/types/check.go:446 +0x15c
go/types.(*Checker).stmt(0xc0001b6000, 0x0, {0x7964e0?, 0xc0001a61c0?})
go/types/stmt.go:403 +0x391
go/types.(*Checker).stmtList(0x7950e8?, 0x0, {0xc0001a4e80?, 0x0?, 0x0?})
go/types/stmt.go:124 +0x85
go/types.(*Checker).funcBody(0xc0001b6000, 0xc000101c20, {0xc000013c80?, 0xc00007ac80?}, 0xc000211200, 0xc00019f230, {0x0, 0x0})
go/types/stmt.go:44 +0x325
go/types.(*Checker).funcDecl.func1()
go/types/decl.go:826 +0x3a
go/types.(*Checker).processDelayed(0xc0001b6000, 0x0)
go/types/check.go:446 +0x15c
go/types.(*Checker).checkFiles(0xc0001b6000, {0xc0001a64b0, 0x2, 0x2})
go/types/check.go:390 +0x245
go/types.(*Checker).Files(...)
go/types/check.go:344
go/types.(*Config).Check(0xc000079a40, {0xc000016750?, 0xc000012047?}, 0xc000194d80, {0xc0001a64b0, 0x2, 0x2}, 0xc000079aa0)
go/types/api.go:436 +0x169
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.run(0xc000194d80, 0xc0001680e0, {0xc000027600, 0xa, 0x0?})
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:235 +0x4a5
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.Run({0x7fffd16c6b1d?, 0x1e?}, {0xc000027600, 0xa, 0x10})
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:133 +0xc8
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.Main({0xc000192000, 0x1e, 0x1e})
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:120 +0x337
main.main()
cmd/vet/main.go:47 +0x41c
? golang.org/x/telemetry/cmd/gotelemetry [no test files]
? golang.org/x/telemetry/counter [no test files]
? golang.org/x/telemetry/internal/mmap [no test files]
ok golang.org/x/telemetry/cmd/gotelemetry/internal/view 0.004s
FAIL golang.org/x/telemetry/counter/countertest [build failed]
ok golang.org/x/telemetry/internal/config 0.003s
ok golang.org/x/telemetry/internal/configstore 0.016s
ok golang.org/x/telemetry/internal/counter 0.063s
ok golang.org/x/telemetry/internal/proxy 0.005s
ok golang.org/x/telemetry/internal/telemetry 0.004s
ok golang.org/x/telemetry/internal/testenv 0.011s
ok golang.org/x/telemetry/internal/upload 0.004s
FAIL
:: Running /workdir/go/bin/go with args ["/workdir/go/bin/go" "test" "-short" "./..."] and env ["HOSTNAME=buildlet-linux-amd64-bullseye-rn552a163" "HOME=/root" "SHLVL=0" "DEBIAN_FRONTEND=noninteractive" "USER=root" "GO_STAGE0_NET_DELAY=0s" "GO_STAGE0_DL_DELAY=200ms" "WORKDIR=/workdir" "GOROOT_BOOTSTRAP=/workdir/go1.4" "GO_BUILDER_NAME=linux-amd64" "GO_DISABLE_OUTBOUND_NETWORK=1" "GOROOT=/workdir/go" "GOPATH=/workdir/gopath" "GOPROXY=http://gk3-services-nap-jetxd907-8f582974-u4g3.c.symbolic-datum-552.internal:30157" "TMPDIR=/workdir/tmp" "GOCACHE=/workdir/gocache" "GOPLSCACHE=/workdir/goplscache" "PATH=/workdir/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" "PWD=/workdir/gopath/src/golang.org/x/telemetry/config"] in dir /workdir/gopath/src/golang.org/x/telemetry/config

? golang.org/x/telemetry/config [no test files]
:: Running /workdir/go/bin/go with args ["/workdir/go/bin/go" "test" "-short" "./..."] and env ["HOSTNAME=buildlet-linux-amd64-bullseye-rn552a163" "HOME=/root" "SHLVL=0" "DEBIAN_FRONTEND=noninteractive" "USER=root" "GO_STAGE0_NET_DELAY=0s" "GO_STAGE0_DL_DELAY=200ms" "WORKDIR=/workdir" "GOROOT_BOOTSTRAP=/workdir/go1.4" "GO_BUILDER_NAME=linux-amd64" "GO_DISABLE_OUTBOUND_NETWORK=1" "GOROOT=/workdir/go" "GOPATH=/workdir/gopath" "GOPROXY=http://gk3-services-nap-jetxd907-8f582974-u4g3.c.symbolic-datum-552.internal:30157" "TMPDIR=/workdir/tmp" "GOCACHE=/workdir/gocache" "GOPLSCACHE=/workdir/goplscache" "PATH=/workdir/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" "PWD=/workdir/gopath/src/golang.org/x/telemetry/godev"] in dir /workdir/gopath/src/golang.org/x/telemetry/godev

go: downloading github.com/yuin/goldmark v1.5.4
go: downloading github.com/yuin/goldmark-meta v1.1.0
go: downloading google.golang.org/api v0.122.0
go: downloading github.com/google/go-cmp v0.5.9
go: downloading golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
go: downloading cloud.google.com/go/storage v1.30.1
go: downloading github.com/fullstorydev/emulators/storage v0.0.0-20230523204811-eccb7d2267b0
go: downloading github.com/evanw/esbuild v0.17.19
go: downloading github.com/google/btree v1.0.1
go: downloading github.com/bluele/gcache v0.0.2
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading google.golang.org/protobuf v1.30.0
go: downloading cloud.google.com/go v0.110.0
go: downloading golang.org/x/sys v0.8.0
go: downloading github.com/google/uuid v1.3.0
go: downloading cloud.google.com/go/iam v1.0.1
go: downloading cloud.google.com/go/compute/metadata v0.2.3
go: downloading github.com/googleapis/gax-go/v2 v2.8.0
go: downloading golang.org/x/oauth2 v0.8.0
go: downloading cloud.google.com/go/compute v1.19.0
go: downloading google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1
go: downloading google.golang.org/grpc v1.55.0
go: downloading go.opencensus.io v0.24.0
go: downloading golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
go: downloading golang.org/x/net v0.10.0
go: downloading github.com/golang/protobuf v1.5.3
go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
go: downloading golang.org/x/text v0.9.0
go: downloading github.com/googleapis/enterprise-certificate-proxy v0.2.3
go: downloading github.com/google/s2a-go v0.1.3
go: downloading google.golang.org/appengine v1.6.7
go: downloading golang.org/x/crypto v0.7.0
? golang.org/x/telemetry/godev [no test files]
? golang.org/x/telemetry/godev/cmd/worker [no test files]
? golang.org/x/telemetry/godev/devtools/cmd/esbuild [no test files]
? golang.org/x/telemetry/godev/devtools/cmd/npmdeps [no test files]
? golang.org/x/telemetry/godev/internal/middleware [no test files]
ok golang.org/x/telemetry/godev/cmd/telemetrygodev 0.014s
ok golang.org/x/telemetry/godev/internal/content 0.022s
ok golang.org/x/telemetry/godev/internal/storage 0.026s
ok golang.org/x/telemetry/godev/internal/unionfs 0.003s

I have a repro and fix.

CC @griesemer @jamalc @hyangah @bcmills

@findleyr findleyr added this to the Go1.22 milestone Aug 7, 2023
@findleyr findleyr self-assigned this Aug 7, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/516738 mentions this issue: go/types: fix panic in allowVersion when pos is invalid

@dmitshur dmitshur added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 20, 2023
@golang golang locked and limited conversation to collaborators Dec 20, 2024
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

3 participants