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

Create API/make generate controller-gen panics with a SIGSEGV #6721

Closed
jrp-enf opened this issue Apr 15, 2024 · 3 comments
Closed

Create API/make generate controller-gen panics with a SIGSEGV #6721

jrp-enf opened this issue Apr 15, 2024 · 3 comments
Labels
language/go Issue is related to a Go operator project

Comments

@jrp-enf
Copy link

jrp-enf commented Apr 15, 2024

Bug Report

What did you do?

operator-sdk create api --group api --version v1 --kind License
INFO[0000] Create Resource [y/n]
y
INFO[0002] Create Controller [y/n]
y

What did you expect to see?

A successful api creation.

What did you see instead? Under which circumstances?

INFO[0002] Writing kustomize manifests for you to edit...
INFO[0002] Writing scaffold for you to edit...
INFO[0002] api/v1/license_types.go
INFO[0002] api/v1/groupversion_info.go
INFO[0002] internal/controller/suite_test.go
INFO[0002] internal/controller/license_controller.go
INFO[0002] internal/controller/license_controller_test.go
INFO[0002] Update dependencies:
$ go mod tidy
INFO[0002] Running make:
$ make generate
mkdir -p /home/jrp/license-operator/bin
test -s /home/jrp/license-operator/bin/controller-gen && /home/jrp/license-operator/bin/controller-gen --version | grep -q v0.13.0 ||
GOBIN=/home/jrp/license-operator/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0
go: downloading sigs.k8s.io/controller-tools v0.13.0
go: downloading k8s.io/apimachinery v0.28.0
go: downloading k8s.io/api v0.28.0
go: downloading github.com/spf13/cobra v1.7.0
go: downloading k8s.io/apiextensions-apiserver v0.28.0
go: downloading github.com/gobuffalo/flect v1.0.2
go: downloading golang.org/x/tools v0.12.0
go: downloading github.com/fatih/color v1.15.0
go: downloading golang.org/x/net v0.14.0
go: downloading github.com/mattn/go-isatty v0.0.17
go: downloading github.com/mattn/go-colorable v0.1.13
go: downloading golang.org/x/sys v0.11.0
go: downloading golang.org/x/mod v0.12.0
go: downloading golang.org/x/text v0.12.0
/home/jrp/license-operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
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=0xa0de4f]

goroutine 183 [running]:
go/types.(*Checker).handleBailout(0xc00080cc00, 0xc00004dd40)
/usr/local/go/src/go/types/check.go:367 +0x88
panic({0xbc7860?, 0x12b38a0?})
/usr/local/go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0xdc3678, 0x12bc080})
/usr/local/go/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
/usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0xdc3678?, 0x12bc080?})
/usr/local/go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0xdc9a50, 0x1286f80}, 0xc00080cc00, 0x12bc080, 0x0)
/usr/local/go/src/go/types/const.go:92 +0x192
go/types.(*Checker).arrayLength(0xc00080cc00, {0xdc7d00, 0xc000a13b20?})
/usr/local/go/src/go/types/typexpr.go:510 +0x2d3
go/types.(*Checker).typInternal(0xc00080cc00, {0xdc6320, 0xc000a21650}, 0x0)
/usr/local/go/src/go/types/typexpr.go:299 +0x49d
go/types.(*Checker).definedType(0xc00080cc00, {0xdc6320, 0xc000a21650}, 0xc00004d328?)
/usr/local/go/src/go/types/typexpr.go:180 +0x37
go/types.(*Checker).varType(0xc00080cc00, {0xdc6320, 0xc000a21650})
/usr/local/go/src/go/types/typexpr.go:145 +0x25
go/types.(*Checker).structType(0xc00080cc00, 0xc000a30d50, 0xc000a30d50?)
/usr/local/go/src/go/types/struct.go:113 +0x19f
go/types.(*Checker).typInternal(0xc00080cc00, {0xdc6290, 0xc000a220d8}, 0xc000a32500)
/usr/local/go/src/go/types/typexpr.go:316 +0x1345
go/types.(*Checker).definedType(0xc00080cc00, {0xdc6290, 0xc000a220d8}, 0xc91787?)
/usr/local/go/src/go/types/typexpr.go:180 +0x37
go/types.(*Checker).typeDecl(0xc00080cc00, 0xc000a32500, 0xc000a14d80, 0x0)
/usr/local/go/src/go/types/decl.go:615 +0x44d
go/types.(*Checker).objDecl(0xc00080cc00, {0xdcf000, 0xc000a32500}, 0x0)
/usr/local/go/src/go/types/decl.go:197 +0xa7f
go/types.(*Checker).packageObjects(0xc00080cc00)
/usr/local/go/src/go/types/resolver.go:681 +0x425
go/types.(*Checker).checkFiles(0xc00080cc00, {0xc000de04c8, 0x3, 0x3})
/usr/local/go/src/go/types/check.go:408 +0x1a5
go/types.(*Checker).Files(...)
/usr/local/go/src/go/types/check.go:372
sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc0002b5380, 0xc0002e2c80)
/home/jrp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/loader.go:286 +0x36a
sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc0002e2c80)
/home/jrp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/loader.go:99 +0x39
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc00074c6f0, 0xc0002e2c80)
/home/jrp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:268 +0x2b7
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check.func1(0x27?)
/home/jrp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:262 +0x53
created by sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check in goroutine 57
/home/jrp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.13.0/pkg/loader/refs.go:260 +0x1c5
make: *** [Makefile:104: generate] Error 2
Error: failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v4": exit status 2
Usage:
operator-sdk create api [flags]
...

Environment

Operator type:

/language go

Kubernetes cluster type:

kind

$ operator-sdk version

operator-sdk version: "v1.34.1", commit: "edaed1e5057db0349568e0b02df3743051b54e68", kubernetes version: "1.28.0", go version: "go1.21.7", GOOS: "linux", GOARCH: "amd64"

$ go version (if language is Go)

go version go1.22.2 linux/amd64

$ kubectl version

Client Version: v1.29.3
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.2

Possible Solution

Additional context

This is the first time I've tried creating a operator. Just before this, I did an
operator-sdk init --domain license-operator.enfabrica.net --repo github.com/jrp-enf/license-operator
which was successful.

@openshift-ci openshift-ci bot added the language/go Issue is related to a Go operator project label Apr 15, 2024
@jrp-enf
Copy link
Author

jrp-enf commented Apr 15, 2024

The problem was golang 1.22 doesn't work. Duplicate of #6681

@jrp-enf jrp-enf closed this as completed Apr 15, 2024
@jrp-enf
Copy link
Author

jrp-enf commented Apr 15, 2024

Oops, no, this still fails with golang 1.21.7.

it fails like this:
INFO[0002] Writing kustomize manifests for you to edit...
INFO[0002] Writing scaffold for you to edit...
INFO[0002] api/v1/license_types.go
INFO[0002] api/v1/groupversion_info.go
INFO[0002] internal/controller/suite_test.go
INFO[0002] internal/controller/license_controller.go
INFO[0002] internal/controller/license_controller_test.go
INFO[0002] Update dependencies:
$ go mod tidy
INFO[0002] Running make:
$ make generate
mkdir -p /home/jrp/license-operator/bin
test -s /home/jrp/license-operator/bin/controller-gen && /home/jrp/license-operator/bin/controller-gen --version | grep -q v0.13.0 ||
GOBIN=/home/jrp/license-operator/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0

internal/chacha8rand

/usr/local/go/src/internal/chacha8rand/chacha8_amd64.s:55: ABI selector only permitted when compiling runtime, reference was to """.block"
asm: assembly of /usr/local/go/src/internal/chacha8rand/chacha8_amd64.s failed
make: *** [Makefile:229: /home/jrp/license-operator/bin/controller-gen] Error 1
Error: failed to create API: unable to run post-scaffold tasks of "base.go.kubebuilder.io/v4": exit status 2

@jrp-enf jrp-enf reopened this Apr 15, 2024
@jrp-enf
Copy link
Author

jrp-enf commented Apr 16, 2024

The last problem was due to a bad go install - I had untarred 1.21 over 1.22 without removing the previous go install.

@jrp-enf jrp-enf closed this as completed Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language/go Issue is related to a Go operator project
Projects
None yet
Development

No branches or pull requests

1 participant