-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: occasional nil pointer dereference in (*Client).send #37598
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
Comments
I searched the last 7 days of my logs for web servers where my crawler ran into this issue. In total 890 web services got crawled. With 8 of them the crawler ran into described issue. I could not reproduce the issue, so I searched for hints/similarities. The similarities I found among all of the them, were:
(Sorry, can't share the hosts, they are within an internal network.) |
As far as I can tell, this can only happen if Is your program using a non-default |
Change https://golang.org/cl/221818 mentions this issue: |
Issue #37598 reports a nil-panic in *Client.send that can only occur if one of the RoundTripper invariants is violated. Unfortunately, that condition is currently difficult to diagnose: it manifests as a panic during a Response field access, rather than something the user can easily associate with an specific erroneous RoundTripper implementation. No test because the new code paths are supposed to be unreachable. Updates #37598 Change-Id: If0451e9c6431f6fab7137de43727297a80def05b Reviewed-on: https://go-review.googlesource.com/c/go/+/221818 Reviewed-by: Brad Fitzpatrick <[email protected]>
Hi, we are:
I added exhaustive logging to our code to find out how far and which paths it executes in the flawed situations. I need to wait until i setp into the situation again, but then I should see better what happened, e.g. whether it made use of the ntlmssp negotiator already, etc... |
Found this: Azure/go-ntlmssp#9 |
Ok it seems to be a bug in go-ntlmssp and there seems to be a magic update: Azure/go-ntlmssp#24 So I will update to that new version and hope the bug disappears. I guess you can close this ticket for now, I'd come back if the issue comes up again. Thank's guys for your time and help! |
Azure/go-ntlmssp#24 seems to be fixing another instance of the problem described in #377. Notably,
I suspect that that means other tools like So, at least we're aware of this class of bug, but it's a shame that the (FYI @ianthehat) |
Nice, I didn't know that tool. But also, we don't have build verification/automation yet (where it would fit into perfectly), as it would be overkill in our current state. Great to have that tool, but we can also assume that there will never be a majority knowing and applying a certain one. Best case, the language doesn't allow or mitigate it. Otherwise, the first step is to know this kind of bug :) Anyways, not complaining... |
What version of Go are you using (
go version
)?go 1.11 and 1.14
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Wrote a web crawler using net/http to crawl large networks with lots of different web services of all ages and technologies. The crawler mostly works great, but ocasionally I'm running into nil pointer dereference panics. I cannot reproduce the issue. Looking at the stacktrace it seems to be burried within net/http and independent of my code.
C:/Go/src/net/http/client.go:271
is where the actual panic araises due to a nil pointer dereference, by accessing.Body
on the response ofresp, err = rt.RoundTrip(req)
. Obviously, for some reason,resp
is nil, due to some unhanled error. So, execution continues until it ends up with a panic callingresp.Body
. Here is a copy of the source code of client.go lines 252-275 for quick reference:Maybe some package expert has an idea, why
rt.RoundTrip(req)
might return nil without error? Obviously, this edge case should not happen, becauseresp
is required down the road...What did you expect to see?
I'm expecting anything but panics. Either an error or a normal response.
What did you see instead?
A panic
The text was updated successfully, but these errors were encountered: