We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
例行检查
问题描述 高并发下有时会报下面得错误, 导致程序崩溃 fatal error: concurrent map read and map write
goroutine 593866 [running]: github.com/songquanpeng/one-api/relay/billing/ratio.GetModelRatio({0xc000c815f0, 0x11}) /build/relay/billing/ratio/model.go:242 +0x19c github.com/songquanpeng/one-api/relay/controller.RelayTextHelper(0xc001e2f700) /build/relay/controller/text.go:38 +0x18f github.com/songquanpeng/one-api/controller.relayHelper(0x11131e0?, 0xc0021d73f0?) /build/controller/relay.go:39 +0x52 github.com/songquanpeng/one-api/controller.Relay(0xc001e2f700) /build/controller/relay.go:81 +0x6b1 github.com/gin-gonic/gin.(*Context).Next(0xc001e2f700) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b github.com/songquanpeng/one-api/router.SetRelayRouter.Distribute.func5(0xc001e2f700) /build/middleware/distributor.go:56 +0x1a5 github.com/gin-gonic/gin.(*Context).Next(0xc001e2f700) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b github.com/songquanpeng/one-api/router.SetRelayRouter.TokenAuth.func4(0xc001e2f700) /build/middleware/auth.go:143 +0x492 github.com/gin-gonic/gin.(*Context).Next(0xc001e2f700) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b github.com/songquanpeng/one-api/router.SetRelayRouter.RelayPanicRecover.func3(0xc001e2f798?) /build/middleware/recover.go:31 +0x45 github.com/gin-gonic/gin.(*Context).Next(0xc001e2f700) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b github.com/songquanpeng/one-api/router.SetRelayRouter.LicenseCheck.func2(0xc001e2f798?) /build/middleware/license.go:15 +0x1c github.com/gin-gonic/gin.(*Context).Next(0xc001e2f700) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b main.main.Sessions.func4(0xc001e2f700) /go/pkg/mod/github.com/gin-contrib/sessions@v1.0.0/sessions.go:54 +0x169 github.com/gin-gonic/gin.(*Context).Next(...) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 github.com/gin-gonic/gin.LoggerWithConfig.func1(0xc001e2f700) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/logger.go:240 +0xdd github.com/gin-gonic/gin.(*Context).Next(0xc001e2f700) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b main.main.RequestId.func3(0xc001e2f700) /build/middleware/request-id.go:16 +0x106 github.com/gin-gonic/gin.(*Context).Next(...) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1(0xc001e2f700) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102 +0x7a github.com/gin-gonic/gin.(*Context).Next(...) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc00016c4e0, 0xc001e2f700) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620 +0x66e github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc00016c4e0, {0x45ad310, 0xc0071e5500}, 0xc0098b6c60) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576 +0x1b2 net/http.serverHandler.ServeHTTP({0x45a9ac0?}, {0x45ad310?, 0xc0071e5500?}, 0x6?) /usr/local/go/src/net/http/server.go:3137 +0x8e net/http.(*conn).serve(0xc000b0c990, {0x45af728, 0xc00001f200}) /usr/local/go/src/net/http/server.go:2039 +0x5e8 created by net/http.(*Server).Serve in goroutine 1 /usr/local/go/src/net/http/server.go:3285 +0x4b4
The text was updated successfully, but these errors were encountered:
No branches or pull requests
例行检查
问题描述
高并发下有时会报下面得错误, 导致程序崩溃
fatal error: concurrent map read and map write
goroutine 593866 [running]:
github.com/songquanpeng/one-api/relay/billing/ratio.GetModelRatio({0xc000c815f0, 0x11})
/build/relay/billing/ratio/model.go:242 +0x19c
github.com/songquanpeng/one-api/relay/controller.RelayTextHelper(0xc001e2f700)
/build/relay/controller/text.go:38 +0x18f
github.com/songquanpeng/one-api/controller.relayHelper(0x11131e0?, 0xc0021d73f0?)
/build/controller/relay.go:39 +0x52
github.com/songquanpeng/one-api/controller.Relay(0xc001e2f700)
/build/controller/relay.go:81 +0x6b1
github.com/gin-gonic/gin.(*Context).Next(0xc001e2f700)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b
github.com/songquanpeng/one-api/router.SetRelayRouter.Distribute.func5(0xc001e2f700)
/build/middleware/distributor.go:56 +0x1a5
github.com/gin-gonic/gin.(*Context).Next(0xc001e2f700)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b
github.com/songquanpeng/one-api/router.SetRelayRouter.TokenAuth.func4(0xc001e2f700)
/build/middleware/auth.go:143 +0x492
github.com/gin-gonic/gin.(*Context).Next(0xc001e2f700)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b
github.com/songquanpeng/one-api/router.SetRelayRouter.RelayPanicRecover.func3(0xc001e2f798?)
/build/middleware/recover.go:31 +0x45
github.com/gin-gonic/gin.(*Context).Next(0xc001e2f700)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b
github.com/songquanpeng/one-api/router.SetRelayRouter.LicenseCheck.func2(0xc001e2f798?)
/build/middleware/license.go:15 +0x1c
github.com/gin-gonic/gin.(*Context).Next(0xc001e2f700)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b
main.main.Sessions.func4(0xc001e2f700)
/go/pkg/mod/github.com/gin-contrib/sessions@v1.0.0/sessions.go:54 +0x169
github.com/gin-gonic/gin.(*Context).Next(...)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/gin-gonic/gin.LoggerWithConfig.func1(0xc001e2f700)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/logger.go:240 +0xdd
github.com/gin-gonic/gin.(*Context).Next(0xc001e2f700)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 +0x2b
main.main.RequestId.func3(0xc001e2f700)
/build/middleware/request-id.go:16 +0x106
github.com/gin-gonic/gin.(*Context).Next(...)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1(0xc001e2f700)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102 +0x7a
github.com/gin-gonic/gin.(*Context).Next(...)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc00016c4e0, 0xc001e2f700)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620 +0x66e
github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc00016c4e0, {0x45ad310, 0xc0071e5500}, 0xc0098b6c60)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576 +0x1b2
net/http.serverHandler.ServeHTTP({0x45a9ac0?}, {0x45ad310?, 0xc0071e5500?}, 0x6?)
/usr/local/go/src/net/http/server.go:3137 +0x8e
net/http.(*conn).serve(0xc000b0c990, {0x45af728, 0xc00001f200})
/usr/local/go/src/net/http/server.go:2039 +0x5e8
created by net/http.(*Server).Serve in goroutine 1
/usr/local/go/src/net/http/server.go:3285 +0x4b4
The text was updated successfully, but these errors were encountered: