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

panic: runtime error: index out of range [2] with length 2 #358

Open
hxy1991 opened this issue Apr 13, 2022 · 1 comment
Open

panic: runtime error: index out of range [2] with length 2 #358

hxy1991 opened this issue Apr 13, 2022 · 1 comment
Assignees

Comments

@hxy1991
Copy link

hxy1991 commented Apr 13, 2022

Hi @bhautikpip

I ran into an error in aws-xray-sdk-go@v1.6.0 that caused my process to stop.

panic: runtime error: index out of range [2] with length 2 [recovered]
	panic: runtime error: index out of range [2] with length 2

goroutine 8124494 [running]:
encoding/json.(*encodeState).marshal.func1()
	/usr/local/go/src/encoding/json/encode.go:328 +0x84
panic({0xa570e0, 0x4002224588})
	/usr/local/go/src/runtime/panic.go:838 +0x20c
encoding/json.mapEncoder.encode({0x4002146868?}, 0x40028ea380, {0x9940c0?, 0x400178b018?, 0x4002146898?}, {0x6?, 0x0?})
	/usr/local/go/src/encoding/json/encode.go:800 +0x53c
encoding/json.structEncoder.encode({{{0x4000099300?, 0x114190?, 0x40028ea380?}, 0x40005f6bd0?}}, 0x40028ea380, {0xaa81e0?, 0x400178af00?, 0x400178af00?}, {0x98?, 0x69?})
	/usr/local/go/src/encoding/json/encode.go:761 +0x178
encoding/json.ptrEncoder.encode({0x4002146a88?}, 0x40028ea380, {0xa99fe0?, 0x400178af00?, 0x14002146ae8?}, {0x16?, 0x0?})
	/usr/local/go/src/encoding/json/encode.go:945 +0x1f4
encoding/json.(*encodeState).reflectValue(0x4002146b38?, {0xa99fe0?, 0x400178af00?, 0x110664?}, {0xf8?, 0x6b?})
	/usr/local/go/src/encoding/json/encode.go:360 +0x74
encoding/json.(*encodeState).marshal(0x4002146ba8?, {0xa99fe0?, 0x400178af00?}, {0x80?, 0xa3?})
	/usr/local/go/src/encoding/json/encode.go:332 +0x124
encoding/json.Marshal({0xa99fe0, 0x400178af00})
	/usr/local/go/src/encoding/json/encode.go:161 +0x40
github.com/aws/aws-xray-sdk-go/xray.packSegments.func1(0x400178af00)
	/go/pkg/mod/github.com/aws/aws-xray-sdk-go@v1.6.0/xray/default_emitter.go:100 +0x19c
github.com/aws/aws-xray-sdk-go/xray.packSegments(0x400178ac00, {0x0, 0x0, 0x0})
	/go/pkg/mod/github.com/aws/aws-xray-sdk-go@v1.6.0/xray/default_emitter.go:110 +0xcc
github.com/aws/aws-xray-sdk-go/xray.packSegments(0x400178aa80, {0x0, 0x0, 0x0})
	/go/pkg/mod/github.com/aws/aws-xray-sdk-go@v1.6.0/xray/default_emitter.go:109 +0xb0
github.com/aws/aws-xray-sdk-go/xray.(*DefaultEmitter).Emit(0x40000be168, 0x4002549f50?)
	/go/pkg/mod/github.com/aws/aws-xray-sdk-go@v1.6.0/xray/default_emitter.go:66 +0x70
github.com/aws/aws-xray-sdk-go/xray.(*Segment).emit(...)
	/go/pkg/mod/github.com/aws/aws-xray-sdk-go@v1.6.0/xray/segment.go:431
github.com/aws/aws-xray-sdk-go/xray.(*Segment).flush(0x400178aa80)
	/go/pkg/mod/github.com/aws/aws-xray-sdk-go@v1.6.0/xray/segment.go:473 +0x344
github.com/aws/aws-xray-sdk-go/xray.(*Segment).send(0x400178aa80)
	/go/pkg/mod/github.com/aws/aws-xray-sdk-go@v1.6.0/xray/segment.go:453 +0x64
github.com/aws/aws-xray-sdk-go/xray.(*Segment).handleContextDone(0x400178aa80)
	/go/pkg/mod/github.com/aws/aws-xray-sdk-go@v1.6.0/xray/segment.go:439 +0x58
github.com/aws/aws-xray-sdk-go/xray.BeginSegmentWithSampling.func1()
	/go/pkg/mod/github.com/aws/aws-xray-sdk-go@v1.6.0/xray/segment.go:136 +0x44
created by github.com/aws/aws-xray-sdk-go/xray.BeginSegmentWithSampling
	/go/pkg/mod/github.com/aws/aws-xray-sdk-go@v1.6.0/xray/segment.go:134 +0xdd0

What's the problem with this, please?
How can I fix it?

Thanks

@bhautikpip bhautikpip self-assigned this Apr 18, 2022
@bhautikpip
Copy link
Contributor

Thanks for reporting this. Can you share more information on how you were using SDK? Which instrumentation you were using? Is it possible to provide a small repro code for this as well? More information on setup would be useful for debugging.

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

2 participants