-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Description
With v1.7.0, a data race has been raised by our unit tests whith -race
(not with previous version)
go version go1.16 linux/amd64
=== RUN TestXXXX
==================
WARNING: DATA RACE
Write at 0x00c0003ce998 by goroutine 169:
github.com/gin-gonic/gin.(*Context).RemoteIP()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/context.go:771 +0x1ac
github.com/gin-gonic/gin.(*Context).ClientIP()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/context.go:740 +0xaf
myproject/common/utils/log.JSONRecover()
/home/jerome-laforge/dev/src/myproject/common/utils/log/ginRecover.go:23 +0x178
github.com/gin-gonic/gin.(*Context).Next()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/context.go:165 +0x106
myproject/common/utils/log.JSONLog()
/home/jerome-laforge/dev/src/myproject/common/utils/log/ginLog.go:24 +0x54
github.com/gin-gonic/gin.(*Context).Next()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/context.go:165 +0xe1
myproject/common/samplerlog.SetMiddleware.func1()
/home/jerome-laforge/dev/src/myproject/common/samplerlog/samplerlog.go:30 +0x6c
github.com/gin-gonic/gin.(*Context).Next()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/context.go:165 +0xac9
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/gin.go:489 +0xa35
github.com/gin-gonic/gin.(*Engine).ServeHTTP()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/gin.go:445 +0x376
net/http.serverHandler.ServeHTTP()
/home/jerome-laforge/sdk/go1.16/src/net/http/server.go:2887 +0xca
net/http.(*conn).serve()
/home/jerome-laforge/sdk/go1.16/src/net/http/server.go:1952 +0x87d
Previous write at 0x00c0003ce998 by goroutine 41:
github.com/gin-gonic/gin.(*Context).RemoteIP()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/context.go:771 +0x1ac
github.com/gin-gonic/gin.(*Context).ClientIP()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/context.go:740 +0xaf
myproject/common/utils/log.JSONRecover()
/home/jerome-laforge/dev/src/myproject/common/utils/log/ginRecover.go:23 +0x178
github.com/gin-gonic/gin.(*Context).Next()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/context.go:165 +0x106
myproject/common/utils/log.JSONLog()
/home/jerome-laforge/dev/src/myproject/common/utils/log/ginLog.go:24 +0x54
github.com/gin-gonic/gin.(*Context).Next()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/context.go:165 +0xe1
myproject/common/samplerlog.SetMiddleware.func1()
/home/jerome-laforge/dev/src/myproject/common/samplerlog/samplerlog.go:30 +0x6c
github.com/gin-gonic/gin.(*Context).Next()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/context.go:165 +0xac9
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/gin.go:489 +0xa35
github.com/gin-gonic/gin.(*Engine).ServeHTTP()
/home/jerome-laforge/go/pkg/mod/github.com/gin-gonic/gin@v1.7.0/gin.go:445 +0x376
net/http.serverHandler.ServeHTTP()
/home/jerome-laforge/sdk/go1.16/src/net/http/server.go:2887 +0xca
net/http.(*conn).serve()
/home/jerome-laforge/sdk/go1.16/src/net/http/server.go:1952 +0x87d
Goroutine 169 (running) created at:
net/http.(*Server).Serve()
/home/jerome-laforge/sdk/go1.16/src/net/http/server.go:3013 +0x644
net/http/httptest.(*Server).goServe.func1()
/home/jerome-laforge/sdk/go1.16/src/net/http/httptest/server.go:308 +0xd8
Goroutine 41 (running) created at:
net/http.(*Server).Serve()
/home/jerome-laforge/sdk/go1.16/src/net/http/server.go:3013 +0x644
net/http/httptest.(*Server).goServe.func1()
/home/jerome-laforge/sdk/go1.16/src/net/http/httptest/server.go:308 +0xd8