-
-
Notifications
You must be signed in to change notification settings - Fork 724
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
Potential race in resty with combination of retries and the buffers pool #225
Comments
@amits1995 Based on the information you have shared (looking at groutine 149 & 109 and the stacktrace), it does not originate from Resty. Could you please investigate it further? if you come across a race condition on resty package, please let me know, I would address as quickly as possible. |
Hey @jeevatkm thx for the response |
Are you careful to call |
@amits1995 Let me check and get back. @moorereason the issue seems like on request side not on response. |
@amits1995 I had a look. The only scenario, Resty uses as-is provided body is Also just to try, could you please apply this patch at your end and test it out? |
We are not using As for the patch, It's going to be extremely painful to check it out so I'll be happy to know what's in there before :) |
@amits1995 As I mentioned above Resty do not share a buffer between requests. I would like to confirm this -
That's why I have shared the patch to test. Patch contains following (you could extract the zip archive to get that) -
I could create a branch with above patch for your testing, if its gonna make it easy. This way you could test the patch from Please let me know. |
Yes, the branch approach will be great. Thx |
@amits1995 I have created a branch https://github.com/go-resty/resty/tree/for-225-try-patch please give it a try and let me know. |
@amits1995 Any updates? |
It'll take a few days I'll update as soon as we deploy |
Okay, please keep me posted. |
Small update - we deployed a version with your patch. |
@amits1995 Thanks for the update. Please keep me posted as you progress. I'm gonna make this issue as a bug and applying patch fix in |
A test for this bug would be fantastic. |
@moorereason I actually tried to reproduce locally but failed
@jeevatkm |
@moorereason @amits1995 I'm not sure how to reproduce the reported scenario. Technically buffer acquire (middleware execution) and buffer release happens within @moorereason can you also review resty request flow and share your thoughts? @amits1995 you're understanding on the patch I did is correct. |
I asked about a test because it's not clear to me why the proposed patch fixed the reported issue. I'll try to spend some more time reviewing this. |
I've posted a PR with a failing test case. |
I apologize. My PR is unsafe for other reasons with a completely different stack trace from the original report. My PR only proves that Back to the drawing board... |
@amits1995, what version of Go produced the original stack trace? |
@moorereason |
Thanks for the gist, @amits1995. I've been unable to reproduce the original stack trace after iterating through several different approaches. BTW, I don't believe the race detector would give a false positive. There's a bug somewhere. I found a very similar data race report at golang/go#25009 (comment). A fix has been committed upstream, but you'll have to build with go1.12rc1 to test it. |
@moorereason Interesting! looks like it might actually be a bug in go http2. |
@amits1995 @moorereason Thank you, glad to see Resty community helping each other. |
@jeevatkm Let's close this issue for now and I'll open again if I see any problems after Go's patch. |
@amits1995 Okay, sure. |
@amits1995, I know we closed this issue, but I'd like to know if Go 1.12, which was released yesterday, resolves this issue for you, so please report back the results. |
@moorereason no worries, I planned on doing so |
how to resolve the issue on resty client getting closed for go routines .my go version go version go1.21.4 darwin/arm64 |
We have a golang project that uses resty as the http client.
We started using the golang race detector in our staging environment and encountered the following race errors:
The code is not open source atm so I cannot show you exactly what wer'e doing but the main takeaways are:
client.NewRequest()
)Any idea what's the problem here? Is it a false positive or not?
Thanks
The text was updated successfully, but these errors were encountered: