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

nil pointer panic in wrapType #12

Open
fasaxc opened this issue May 5, 2020 · 0 comments
Open

nil pointer panic in wrapType #12

fasaxc opened this issue May 5, 2020 · 0 comments

Comments

@fasaxc
Copy link

fasaxc commented May 5, 2020

In a CI run of our project, we hit the following panic (using the kubernetes client to list some custom resources):

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x0]

goroutine 165 [running]:
github.com/modern-go/reflect2.(*frozenConfig).wrapType(0xc00036d150, 0xc000666a00, 0xc0001914a0, 0x0, 0x0)
	/go/pkg/mod/github.com/modern-go/[email protected]/reflect2.go:168 +0x6f
github.com/modern-go/reflect2.(*frozenConfig).Type2(0xc00036d150, 0xc000666a00, 0xc0001914a0, 0x1, 0xc000b6e6e0)
	/go/pkg/mod/github.com/modern-go/[email protected]/reflect2.go:161 +0xa1
github.com/modern-go/reflect2.(*UnsafeStructField).Type(0xc000c08000, 0xe0, 0x22900fb)
	/go/pkg/mod/github.com/modern-go/[email protected]/unsafe_field.go:37 +0x45
github.com/json-iterator/go.describeStruct(0xc000c01e30, 0x2855940, 0xc000c01e90, 0x7f0300023d98)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_extension.go:349 +0xab2
github.com/json-iterator/go.decoderOfStruct(0xc000c01e30, 0x2855940, 0xc000c01e90, 0x0, 0x0)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_struct_decoder.go:14 +0xb6
github.com/json-iterator/go._createDecoderOfType(0xc000c01e30, 0x2855940, 0xc000c01e90, 0xc000b87998, 0xc0003d2f00)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:176 +0x4aa
github.com/json-iterator/go.createDecoderOfType(0xc000c01e30, 0x2855940, 0xc000c01e90, 0x0, 0x0)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:142 +0x10b
github.com/json-iterator/go.decoderOfType(0xc000c01e30, 0x2855940, 0xc000c01e90, 0x22900f0, 0x1)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:124 +0x78
github.com/json-iterator/go.describeStruct(0xc00080bc40, 0x2855940, 0xc000bf17d0, 0x7f030000be34)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_extension.go:380 +0xa4f
github.com/json-iterator/go.decoderOfStruct(0xc00080bc40, 0x2855940, 0xc000bf17d0, 0x0, 0x0)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_struct_decoder.go:14 +0xb6
github.com/json-iterator/go._createDecoderOfType(0xc00080bc40, 0x2855940, 0xc000bf17d0, 0xc0009e7e28, 0x212e0c0)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:176 +0x4aa
github.com/json-iterator/go.createDecoderOfType(0xc00080bc40, 0x2855940, 0xc000bf17d0, 0x0, 0x0)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:142 +0x10b
github.com/json-iterator/go.decoderOfType(0xc00080bc40, 0x2855940, 0xc000bf17d0, 0x22900f0, 0x1)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:124 +0x78
github.com/json-iterator/go.decoderOfSlice(0xc000bf16e0, 0x28558a0, 0xc000b95740, 0x0, 0x0)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_slice.go:12 +0x105
github.com/json-iterator/go._createDecoderOfType(0xc000bf16e0, 0x28558a0, 0xc000b95740, 0xc0009e7e18, 0xc0003d2f00)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:180 +0x4ff
github.com/json-iterator/go.createDecoderOfType(0xc000bf16e0, 0x28558a0, 0xc000b95740, 0x0, 0x0)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:142 +0x10b
github.com/json-iterator/go.decoderOfType(0xc000bf16e0, 0x28558a0, 0xc000b95740, 0x22900f0, 0x1)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:124 +0x78
github.com/json-iterator/go.describeStruct(0xc00080c380, 0x2855940, 0xc000bf0f30, 0x1fbd6)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_extension.go:380 +0xa4f
github.com/json-iterator/go.decoderOfStruct(0xc00080c380, 0x2855940, 0xc000bf0f30, 0x0, 0x0)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect_struct_decoder.go:14 +0xb6
github.com/json-iterator/go._createDecoderOfType(0xc00080c380, 0x2855940, 0xc000bf0f30, 0xc0009e7dc8, 0xc0003d2f00)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:176 +0x4aa
github.com/json-iterator/go.createDecoderOfType(0xc00080c380, 0x2855940, 0xc000bf0f30, 0x0, 0x0)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:142 +0x10b
github.com/json-iterator/go.decoderOfType(0xc00080c380, 0x2855940, 0xc000bf0f30, 0x0, 0x0)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:124 +0x78
github.com/json-iterator/go.(*frozenConfig).DecoderOf(0xc00049a1e0, 0x2855800, 0xc000bf0e70, 0x2855800, 0xc000bf0e70)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:114 +0x111
github.com/json-iterator/go.(*Iterator).ReadVal(0xc0007cac60, 0x2199a00, 0xc000344070)
	/go/pkg/mod/github.com/json-iterator/[email protected]/reflect.go:72 +0x1ce
github.com/json-iterator/go.(*frozenConfig).Unmarshal(0xc00049a1e0, 0xc000ba6c00, 0x2d7, 0x600, 0x2199a00, 0xc000344070, 0x0, 0x0)
	/go/pkg/mod/github.com/json-iterator/[email protected]/config.go:348 +0xd2
k8s.io/apimachinery/pkg/runtime/serializer/json.(*Serializer).Decode(0xc0000d4050, 0xc000ba6c00, 0x2d7, 0x600, 0x0, 0x27cb780, 0xc000344070, 0x3d, 0x1, 0x0, ...)
	/go/pkg/mod/k8s.io/[email protected]/pkg/runtime/serializer/json/json.go:263 +0x600
k8s.io/apimachinery/pkg/runtime.WithoutVersionDecoder.Decode(0x27b2c20, 0xc0000d4050, 0xc000ba6c00, 0x2d7, 0x600, 0x0, 0x27cb780, 0xc000344070, 0xc0008c7600, 0xc0008c7500, ...)
	/go/pkg/mod/k8s.io/[email protected]/pkg/runtime/helper.go:252 +0x97
k8s.io/client-go/rest.Result.Into(0xc000ba6c00, 0x2d7, 0x600, 0xc000483c20, 0x10, 0x0, 0x0, 0xc8, 0x27b5820, 0xc000bf4360, ...)
	/go/pkg/mod/k8s.io/[email protected]/rest/request.go:1182 +0xba
...

We've only seen the panic once so far despite running many CI runs daily.

Reported in json-iter too; not sure where it belongs: json-iterator/go#462

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant