-
Notifications
You must be signed in to change notification settings - Fork 425
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
[controller-gen] invalid memory address or nil pointer dereference [recovered] #888
Comments
This is happened with controller-gen v0.13.0, when I upgrade to v0.14.0, it disappears. |
* Bump to go 1.22.x * avoid controller-gen panic: kubernetes-sigs/controller-tools#888
Still got this on 14.0
|
I have the same with the latest version on alpine docker image 1.22-alpine and 1.21-alpine |
controller-gen panics on some of our repos now, specifically found this in database-credential-operator. ``` go run sigs.k8s.io/controller-tools/cmd/[email protected] object paths=./api/k8s/database/v1 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=0x2 addr=0x0 pc=0x103280e80] ``` kubernetes-sigs/controller-tools#888
controller-gen panics on some of our repos now, specifically found this in database-credential-operator. ``` go run sigs.k8s.io/controller-tools/cmd/[email protected] object paths=./api/k8s/database/v1 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=0x2 addr=0x0 pc=0x103280e80] ``` kubernetes-sigs/controller-tools#888
controller-gen panics on some of our repos now, specifically found this in database-credential-operator. ``` go run sigs.k8s.io/controller-tools/cmd/[email protected] object paths=./api/k8s/database/v1 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=0x2 addr=0x0 pc=0x103280e80] ``` kubernetes-sigs/controller-tools#888
Is anyone able to provide a minimal repo to reproduce this issue with the latest release? (alternatively a PR with a fix and unit test which triggers the panic without the fix would also work) |
@sbueringer this is not present on v0.14.0. ( |
@shanduur Thx for the confirmation for your case. There seem to be other cases though: #888 (comment) No idea if that is the same panic though as the issue description doesn't show a full stacktrace. |
I have an older version, but a similar error occurred in v0.9.0. ( 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=0x0 pc=0xa00acf]
goroutine 178 [running]:
go/types.(*Checker).handleBailout(0xc000382a00, 0xc001271d40)
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/check.go:367 +0x88
panic({0xbb0600?, 0x128fd00?})
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0xda2d78, 0x1298560})
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/sizes.go:333
go/types.representableConst.func1({0xda2d78?, 0x1298560?})
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/const.go:76 +0x9e
go/types.representableConst({0xda90e0, 0x12645a0}, 0xc000382a00, 0x1298560, 0x0)
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/const.go:92 +0x192
go/types.(*Checker).arrayLength(0xc000382a00, {0xda73a8, 0xc0018f84c0?})
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/typexpr.go:510 +0x2d3
go/types.(*Checker).typInternal(0xc000382a00, {0xda59f8, 0xc00121ccc0}, 0x0)
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/typexpr.go:299 +0x49d
go/types.(*Checker).definedType(0xc000382a00, {0xda59f8, 0xc00121ccc0}, 0xc001271328?)
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/typexpr.go:180 +0x37
go/types.(*Checker).varType(0xc000382a00, {0xda59f8, 0xc00121ccc0})
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/typexpr.go:145 +0x25
go/types.(*Checker).structType(0xc000382a00, 0xc001b123f0, 0xc001b123f0?)
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/struct.go:113 +0x19f
go/types.(*Checker).typInternal(0xc000382a00, {0xda5968, 0xc001217320}, 0xc001b0b400)
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/typexpr.go:316 +0x1345
go/types.(*Checker).definedType(0xc000382a00, {0xda5968, 0xc001217320}, 0xc785e2?)
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/typexpr.go:180 +0x37
go/types.(*Checker).typeDecl(0xc000382a00, 0xc001b0b400, 0xc001219040, 0x0)
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/decl.go:615 +0x44d
go/types.(*Checker).objDecl(0xc000382a00, {0xdae620, 0xc001b0b400}, 0x0)
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/decl.go:197 +0xa7f
go/types.(*Checker).packageObjects(0xc000382a00)
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/resolver.go:681 +0x425
go/types.(*Checker).checkFiles(0xc000382a00, {0xc000c7ec78, 0x3, 0x3})
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/check.go:408 +0x1a5
go/types.(*Checker).Files(...)
/home/linuxbrew/.linuxbrew/Cellar/go/1.22.2/libexec/src/go/types/check.go:372
sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc000362e40, 0xc0005106e0)
/home/xxx/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:286 +0x36a
sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc0005106e0)
/home/xxx/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/loader.go:99 +0x39
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc000ae6ed0, 0xc0005106e0)
/home/xxx/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:268 +0x2b7
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check.func1(0x4a?)
/home/xxx/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:262 +0x53
created by sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check in goroutine 114
/home/xxx/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/loader/refs.go:260 +0x1c5
make: *** [Makefile:132: generate] Error 2 Previously, no such error occurred. |
Not necessarily a minimal repo, but the GH actions for https://github.com/sapcc/maintenance-controller/actions/runs/8573915772/job/23499644206 fail consistently with go 1.22. |
Using the package in https://github.com/argoproj/argo-cd, when the package (v0.4.1) is installed with 1.22, I get the same error as above. |
Have you considered upgrading controller-gen? Current version is now v0.14 (we're close to v0.15). To be honest, not sure if anyone has time to look into why a release from November 2020 doesn't work with Go 1.22 |
Is anyone able to provide a minimal repo to reproduce this issue with the latest release (v0.14) :) |
I'm going to close this issue in the meantime. Feel free to reopen if we can reproduce it with the latest release. For folks using older versions I would recommend upgrading :) /close |
Update to the newer version to omit issue [1]. [1] kubernetes-sigs/controller-tools#888 Signed-off-by: Ivan Kolodiazhnyi <[email protected]>
Avoid make generate panic: kubernetes-sigs/controller-tools#888 Signed-off-by: Alex Kalenyuk <[email protected]>
Avoid make generate panic: kubernetes-sigs/controller-tools#888 Signed-off-by: Alex Kalenyuk <[email protected]>
* Update builder to use golang 1.22.3 Signed-off-by: Alex Kalenyuk <[email protected]> * Update controller-gen to v0.14.0 Avoid make generate panic: kubernetes-sigs/controller-tools#888 Signed-off-by: Alex Kalenyuk <[email protected]> --------- Signed-off-by: Alex Kalenyuk <[email protected]>
Just noting that our finding is that controller-tools 0.13 onwards works with Go 1.22, but 0.12.1 and older fails. We have CAPM3 1.5 release branch now failing with Go 1.22 (using ct 0.12.1), but CAPM3 1.6 with ct 0.13.0 is green. (1.5 is EOS, so no worries) |
Error log here: https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_lws/11/pull-lws-test-main/1763464055189671936
This is my command:
CMD
Output(error):
However, if I add
-h
to controller-gen, everything goes well:CMD:
Output:
Anyone can provide some advices?
/kind bug
/kind support
The text was updated successfully, but these errors were encountered: