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

Segfault while importing CUE definitions from Istio API definitions #2402

Closed
Niksko opened this issue May 12, 2023 · 2 comments
Closed

Segfault while importing CUE definitions from Istio API definitions #2402

Niksko opened this issue May 12, 2023 · 2 comments
Labels
NeedsInvestigation Triage Requires triage/attention

Comments

@Niksko
Copy link

Niksko commented May 12, 2023

What version of CUE are you using (cue version)?

$ cue version
cue version v0.5.0

go version go1.20.3
      -buildmode exe
       -compiler gc
       -trimpath true
     CGO_ENABLED 1
          GOARCH amd64
            GOOS darwin
         GOAMD64 v1

Does this issue reproduce with the latest stable release?

Yes

What did you do?

cd $(mktemp -d)
(
set -e
cue mod init
go mod init mod.test
go get istio.io/api/networking/v1beta1@v0.0.0-20230511193058-044e6e6ce64a
cue get go istio.io/api/networking/v1beta1
)

What did you expect to see?

No segfault, and definitions that work.
Interestingly, the definitions are still generated in my cue.mod directory but perhaps I'm missing some?
If I try to make use of a definition by importing them, I get errors:

import failed: import failed: cannot find package "google.golang.org/protobuf/types/known/durationpb":
    ./definitions/routing.cue:7:2
    ./cue.mod/gen/istio.io/api/networking/v1beta1/virtual_service.pb_go_gen.cue:7:8

What did you see instead?

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=0x16ff0f9]

goroutine 1 [running]:
cuelang.org/go/cmd/cue/cmd.recoverError(0xc00c4ade90)
	cuelang.org/go/cmd/cue/cmd/root.go:261 +0x7b
panic({0x17aeca0, 0x1e09ee0})
	runtime/panic.go:884 +0x213
cuelang.org/go/cmd/cue/cmd.(*extractor).extractPkg(0xc00a6234d0, {0xc000040054, 0x3f}, 0x0)
	cuelang.org/go/cmd/cue/cmd/get_go.go:438 +0x79
cuelang.org/go/cmd/cue/cmd.(*extractor).extractPkg(0xc00a6234d0, {0xc000040054, 0x3f}, 0xc0000cca80)
	cuelang.org/go/cmd/cue/cmd/get_go.go:554 +0xb1a
cuelang.org/go/cmd/cue/cmd.extract(0xc000354ed0, {0xc000392050, 0x1, 0x1})
	cuelang.org/go/cmd/cue/cmd/get_go.go:417 +0x3e5
cuelang.org/go/cmd/cue/cmd.mkRunE.func1(0xc000388280?, {0xc000392050, 0x1, 0x1})
	cuelang.org/go/cmd/cue/cmd/root.go:72 +0xb3
github.com/spf13/cobra.(*Command).execute(0xc000388280, {0xc000392020, 0x1, 0x1})
	github.com/spf13/cobra@v1.4.0/command.go:856 +0x67c
github.com/spf13/cobra.(*Command).ExecuteC(0xc00036ea00)
	github.com/spf13/cobra@v1.4.0/command.go:974 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.4.0/command.go:902
cuelang.org/go/cmd/cue/cmd.(*Command).Run(0xc000354ed0, {0x3?, 0x3?})
	cuelang.org/go/cmd/cue/cmd/root.go:246 +0x6b
cuelang.org/go/cmd/cue/cmd.mainErr({0x1996288, 0xc00019c008}, {0xc00019a050?, 0x1fa9a68?, 0x60?})
	cuelang.org/go/cmd/cue/cmd/root.go:183 +0x55
cuelang.org/go/cmd/cue/cmd.Main()
	cuelang.org/go/cmd/cue/cmd/root.go:165 +0x7c
main.main()
	cuelang.org/go/cmd/cue/main.go:24 +0x19

This also segfaults on the latest alpha, and segfaults on 0.4.3.

@Niksko Niksko added NeedsInvestigation Triage Requires triage/attention labels May 12, 2023
@Niksko
Copy link
Author

Niksko commented May 12, 2023

Possibly related issue, though it doesn't have any details? istio/api#2620

@Niksko
Copy link
Author

Niksko commented May 12, 2023

Apologies, this seems to be a dup of #2046

You can solve the import issue with:

cue get go google.golang.org/protobuf/types/known/durationpb

However at this point, you will realize that the generated definitions of a lot of #SomeDefinition: _, presumably because of the segfault that aborted the above operation.

Would love a workaround if anyone has one.

@Niksko Niksko closed this as completed May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

1 participant