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

[BUG] Integer overflow on 32-bit startup #418

Closed
kb2ma opened this issue Jul 19, 2021 · 3 comments · Fixed by #429
Closed

[BUG] Integer overflow on 32-bit startup #418

kb2ma opened this issue Jul 19, 2021 · 3 comments · Fixed by #429
Labels
kind/bug Something isn't working

Comments

@kb2ma
Copy link

kb2ma commented Jul 19, 2021

Issue Description

Type: bug report

Crash at startup due to integer overlow on 32-bit platform

Describe what happened

Sentinel is a plugin feature in dapr's latest release v1.2.2. Startup is triggered with api.initWithConfig() within a Docker container. Usually I see an error like below, except the out of range value changes but is always negative.

panic: runtime error: index out of range [-17]

goroutine 1 [running]:
github.com/alibaba/sentinel-golang/core/stat/base.NewAtomicBucketWrapArrayWithTime(0x14, 0x1f4, 0x6a05bff2, 0x17a, 0x2f04df4, 0x4b686a0, 0x4b686a0)
	/home/runner/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.2/core/stat/base/leap_array.go:83 +0x334
github.com/alibaba/sentinel-golang/core/stat/base.NewAtomicBucketWrapArray(0x14, 0x1f4, 0x2f04df4, 0x4b686a0, 0xf9c)
	/home/runner/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.2/core/stat/base/leap_array.go:108 +0x48
github.com/alibaba/sentinel-golang/core/stat/base.NewBucketLeapArray(0x14, 0x2710, 0x11f18)
	/home/runner/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.2/core/stat/base/bucket_leap_array.go:60 +0x84
github.com/alibaba/sentinel-golang/core/stat.NewBaseStatNode(0x2, 0x3e8, 0x66c63009)
	/home/runner/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.2/core/stat/base_node.go:36 +0x30
github.com/alibaba/sentinel-golang/core/stat.NewResourceNode(0x29d5d0f, 0x19, 0x0, 0x1c920)
	/home/runner/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.2/core/stat/resource_node.go:32 +0x34
github.com/alibaba/sentinel-golang/core/stat.init()
	/home/runner/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.2/core/stat/node_storage.go:27 +0x2c

Describe what you expected to happen

No crash!

How to reproduce it (as minimally and precisely as possible)

Nothing special to trigger the problem. I expect the error to happen on any 32-bit platform.

Tell us your environment

Running sentinel v1.0.2 on a Raspberry Pi Compute Module 3+, compiled for linux/arm architecture.

Anything else we need to know?

Debugging shows the issue pretty clearly is here. timeId is Unix epoch time in msec, a 64-bit value; len is 500.

@sczyh30 sczyh30 added the kind/bug Something isn't working label Jul 20, 2021
@sczyh30
Copy link
Member

sczyh30 commented Jul 20, 2021

Thanks for reporting. We'll fix it soon.

@kb2ma
Copy link
Author

kb2ma commented Jul 21, 2021

FWIW, I have implemented a workaround.

@sczyh30
Copy link
Member

sczyh30 commented Oct 11, 2022

Fixed in #429

@sczyh30 sczyh30 closed this as completed Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants