-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed as not planned
Labels
FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
Currently, if I try to issue a HTTP request with a nil *http.Client, I get a fairly inscrutable error message - here's a sample from the aws-sdk-go library. My initial thought was the library did something wrong with timeouts.
Error
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x662c54]
goroutine 35 [running]:
net/http.(*Client).deadline(0xb75780?)
/usr/local/go/src/net/http/client.go:189 +0x14
net/http.(*Client).do(0x0, 0xc000440300)
/usr/local/go/src/net/http/client.go:611 +0x225
net/http.(*Client).Do(...)
/usr/local/go/src/net/http/client.go:593
github.com/aws/aws-sdk-go/aws/corehandlers.sendFollowRedirects(0xc0a54e5cabd8ad81?)
/src/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go:120 +0x27
github.com/aws/aws-sdk-go/aws/corehandlers.glob..func3(0xc000442500)
/src/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go:112 +0x176
The actual problem is that we are trying to make a HTTP request with a nil http.Client
, which you can reproduce with the following two lines.
var client *http.Client
client.Get("http://jsonip.com")
What do you think about adding a nil check inside *Client.do()
, and then panicking with a better error message?
Metadata
Metadata
Assignees
Labels
FixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.