-
Notifications
You must be signed in to change notification settings - Fork 718
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 in resty.(*Client).execute() #29
Comments
Thanks for reporting. I will have a look. |
@iyidan I have analyzed it, will be available in next version. If you have PR for this, feel free to send it. |
@iyidan - I have taken care of it, however will do improvements later. |
It will be part of v0.8 release, available in |
Sorry to resurrect this, just to let you know: This has broken my client as resty is not parallel anymore. I knew about the data race but it was not affecting my use case. I can fix it without much issues, but please be careful in the future about changes that change the behavior of resty so much. Thanks for the library, will keep using it! :) |
@mrd0ll4r I'm sorry about you ran into issue. Please let me know your suggestion to improve resty. I will think about keeping parallel and prevent data race in the mean time. Looking forward to your inputs. |
Hard to say - you could use an You could always just say "resty is not thread safe when modifying proxy settings (and maybe more), do thread safety in your code", which works fine for me. |
You'd still protect the top-level proxy with an |
@mrd0ll4r that's the plan, I'm gonna give it try. |
@mrd0ll4r @wanghp - mutex lock is removed from resty. I have tried RWMutex however it is not needed anymore. I need to add note for, if resty user is modifying resty client setting from multiple goroutine/dynamically they have to use their own locking mechanism. I have pushed changes to master. resty Performance is improved. |
@jeevatkm , thanks for the quick response! Looks good. |
@wanghq have you tested |
@jeevatkm , I didn't notice any issue with the master branch. Thanks again. |
@wanghq Thank you for the confirmation. |
Hello,
I am use resty in multi-goroutine and case the DATA RACE
test.go
`package main
import (
"github.com/go-resty/resty"
"sync"
)
func main() {
go run -race test.go`
w := sync.WaitGroup{}
for i := 0; i < 50; i++ {
w.Add(1)
go func() {
defer w.Done()
resty.R().Get("http://httpbin.org/get")
}()
}
w.Wait()
}
The text was updated successfully, but these errors were encountered: