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

Sentinel 限流 限流BUG #788

Open
xiaopihai1 opened this issue Mar 30, 2024 · 0 comments
Open

Sentinel 限流 限流BUG #788

xiaopihai1 opened this issue Mar 30, 2024 · 0 comments
Labels

Comments

@xiaopihai1
Copy link

go version go1.22.1 windows/amd64

处理器 12th Gen Intel(R) Core(TM) i7-12700H 2.30 GHz
系统类型 64 位操作系统, 基于 x64 的处理器

go run main.go version
2.1.2

// Sentinel 限流
func Sentinel() gin.HandlerFunc {
if _, err := system.LoadRules([]*system.Rule{
{
MetricType: system.InboundQPS,
TriggerCount: 200,
Strategy: system.BBR,
},
}); err != nil {
log.Fatalf("Unexpected error: %+v", err)
}
return sentinel.SentinelMiddleware(
sentinel.WithBlockFallback(func(ctx *gin.Context) {
ctx.AbortWithStatusJSON(200, map[string]interface{}{
"msg": "too many request; the quota used up!",
"code": 500,
})
}),
)
}

是阿里那个包的问题么

github.com/alibaba/sentinel-golang/core/stat/base.(*AtomicBucketWrapArray).elementOffset
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/core/stat/base/leap_array.go:108
github.com/alibaba/sentinel-golang/core/stat/base.(*AtomicBucketWrapArray).compareAndSet
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/core/stat/base/leap_array.go:130
github.com/alibaba/sentinel-golang/core/stat/base.(*LeapArray).currentBucketOfTime
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/core/stat/base/leap_array.go:194
github.com/alibaba/sentinel-golang/core/stat/base.(*BucketLeapArray).currentBucketWithTime
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/core/stat/base/bucket_leap_array.go:112
github.com/alibaba/sentinel-golang/core/stat/base.(*BucketLeapArray).updateConcurrencyWithTime
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/core/stat/base/bucket_leap_array.go:104
github.com/alibaba/sentinel-golang/core/stat/base.(*BucketLeapArray).UpdateConcurrency
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/core/stat/base/bucket_leap_array.go:100
github.com/alibaba/sentinel-golang/core/stat.(*BaseStatNode).UpdateConcurrency
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/core/stat/base_node.go:72
github.com/alibaba/sentinel-golang/core/stat.(*BaseStatNode).IncreaseConcurrency
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/core/stat/base_node.go:96
github.com/alibaba/sentinel-golang/core/stat.(*Slot).recordPassFor
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/core/stat/stat_slot.go:80
github.com/alibaba/sentinel-golang/core/stat.(*Slot).OnEntryPassed
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/core/stat/stat_slot.go:50
github.com/alibaba/sentinel-golang/core/base.(*SlotChain).Entry
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/core/base/slot_chain.go:211
github.com/alibaba/sentinel-golang/api.entry
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/api/api.go:169
github.com/alibaba/sentinel-golang/api.Entry
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang@v1.0.4/api/api.go:146
github.com/alibaba/sentinel-golang/pkg/adapters/gin.SentinelMiddleware.func1
C:/Users/18796/go/pkg/mod/github.com/alibaba/sentinel-golang/pkg/adapters/gin@v0.0.0-20230626085943-08071855bc67/middleware.go:24
github.com/gin-gonic/gin.(*Context).Next
C:/Users/18796/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
C:/Users/18796/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620
github.com/gin-gonic/gin.(*Engine).ServeHTTP
C:/Users/18796/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576
net/http.serverHandler.ServeHTTP
C:/Program Files/Go/src/net/http/server.go:3137
net/http.(*conn).serve
C:/Program Files/Go/src/net/http/server.go:2039
runtime.goexit
C:/Program Files/Go/src/runtime/asm_386.s:1363
{"timestamp":"2024-03-30 14:59:52.52300","caller":"leap_array.go:108","logLevel":"ERROR","msg":"array index out of bounds in AtomicBucketWrapArray.elementOffset()","idx":-3,"arrayLength":20}
array index out of bounds

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

No branches or pull requests

1 participant