-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Data race with gin-gonic v1.7.0 #2674
Comments
can be reproduce with this simple test: package test
import (
"net/http"
"testing"
"github.com/gin-gonic/gin"
)
func BenchmarkRace(b *testing.B) {
r := gin.New()
r.GET("/", func(ctx *gin.Context) {
ctx.String(http.StatusOK, ctx.ClientIP())
})
go http.ListenAndServe(":8080", r)
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
resp, err := http.Get("http://127.0.0.1:8080/")
if err != nil {
b.Error(err)
continue
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
b.Fail()
}
}
})
}
|
https://github.com/gin-gonic/gin/blob/master/context.go#L771 |
2 tasks
appleboy
added a commit
that referenced
this issue
Apr 8, 2021
Co-authored-by: Bo-Yi Wu <[email protected]>
Fixed in #2675 |
bump to v1.7.1 version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: