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
net/http: panic: runtime error: slice bounds out of range #12339
Comments
Thank you for this bug report. Have you confirmed your code is free of data races ? If so, can you please include some sample code that demonstrates the issue so that others can try to confirm the issue you are seeing. |
Code used to replicate issue seen in another application (with URLs redacted):
-race yields:
EDIT: changed the code above to only access resp if RoundTrip was successful. Reran test to confirm that the issue persists (it does). |
Thank you for providing your sample code. Although it should not matter for this issue, I cannot see where you are closing the response body. /cc @bradfitz |
I wanted a small piece of example code exhibiting the problem I saw in another application. I should have taken more care in writing it. I've now tested the example above with resp.Body.Close(). The problem persists. |
I'm not clear on your initial report: does this failure happen with 1.4.2, or only with 1.5? |
It happens on both 1.4.2 and 1.5. EDIT: paths above relating to /home/sebastian/go is go 1.5 |
Can you email me privately the URL(s) I can hit to reproduce this? I am |
Email sent |
I can't reproduce. Can you reproduce with Go tip? (what is to become Go 1.6 soon-ish) |
With same code/line-numbers as in email, using master (assuming master == tip):
|
@sebcat, can you try again with the latest code from master? I was never able to reproduce this myself but I wonder if one my recent commits might have fixed this. The same output as before would be great. Thanks! |
(In particular, I think https://golang.org/cl/17890 could've fixed this) |
I am afraid that I am still able to reproduce. I'm looking into the possibility to set up a reproducible test environment. I tried reproducing it on a virtual instance at DO, but no luck (maybe related to difference in latency/different responses from server due to geoloc? purely speculation).
|
Thanks for the update. The updated crash with new line numbers helps. I'll look again. |
Sorry, I haven't forgotten about this. I'm just getting back to things after the holidays. Can I trouble you to try once again from master? Some changes just went in which have a small but non-zero chance of fixing this. If you can reproduce the race again (or not), please include the git version number in your reply. Thanks! |
I am no longer able to reproduce the problem. Building with -race and executing produces no output from the race detector and no panic occurs over multiple runs.
Thank you! |
Excellent. Thank you for your help testing. For the record, I suspect the change which fixed it was git rev 7fa9846 (https://go-review.googlesource.com/18282) or less likely 7de71c8 (https://go-review.googlesource.com/18260) |
Hello,
I experience a panic intermittently when using a Transport concurrently against certain URLs. It happens when I read the response body using an io.LimitedReader with ioutil.ReadAll.
I've isolated the problem from a larger application and I would like to share the code for issue reproduction privately, as I am only able to reproduce it for certain URLs and I don't want those URLs in the issue tracker.
I've tested the example with go 1.4.2 and go 1.5 on a couple of different machines. If I run the example locally, I may have to run it a few times before experiencing a panic. If I run the example on a remote machine with different network/hardware/linux distribution that I have access to, it occurs 100% of the time. I don't know why.
Complete stack trace:
The text was updated successfully, but these errors were encountered: